<script>
function click()
{
var username = prompt("Enter ur name:");
if(username)
{
alert("Hi,"+username);
document.getElementById("rockPic").src = "rocksmile.jpg";
}
}
</script>
<img id = "rockPic"
align = "center";
src = "rock.jpg";
alt = "irock";
height = 200px;
width = 200px;
style = "cursor:pointer";
onclick = "click();">
</body>
In this code while clicking on the image then 'prompt' box must be displayed. But it is doing nothing. please help!