javascript function - the correct way to do this -


Hi all and thanks for watching,

What is the correct way to do this:

& lt; Script language = "javascript" & gt; Function flag (nation) {this.nation = nation; Document.getElementById ("flag"). InnerHTML = "& lt; img src = 'Pictures / Flags /' + National + '.jpg' & gt;"; } & Lt; / Script & gt;

In this link tag: onClick = "flag (Scottslands)"; And the name of the image is scotislands.jpg

Many thanks, b.

Your string identifier has been compiled in the following line:

 < Code> document.getElementById ("flag"). InnerHTML = "& lt; img src = 'Pictures / Flags /' + National + '.jpg' & gt;";  

It should be:

  document.getElementById ("flag"). InnerHTML = '& lt; Img src = "pictures / flags / '+ nation +' .jpg" & gt; '; Apart from this, Joel saw,  onClick = "flag (scotislands)";  should be  onClick = "flag ('Scottslands')";  


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -