You need to quote the text in the link tag, otherwise it will try to find and not find the variable with the name scotislands.
onClick="flag('scotislands');"
then change the innerHTML assignment to the following:
document.getElementById("flag").innerHTML="<img src='images/flags/" + nation + ".jpg'>"
URL, .
, - ( ). , jQuery, - :
<a href="#scotislands" class="flag-identifier">Scotislands</a>
, javascript, :
$(function() {
$('a.flag-identifier').click( function() {
var flag = $(this).attr('href').replace('#','');
$('#flag').html( '<img src="images/flags/' + flag + '.jpg" />' );
return false;
});
});
, href , flag , URL- . , nation, , .