Hi everyone,
This is my first javascript code and it is not working for me !
I try to place an image at a div. What that image would be it depends on a parameter I send to a js function.
This is what my HTML page:
When I run it, the picture doesn't show up. Nothing shows up :-(.
Could anyone instruct me how to do it right ?
Thanks
This is my first javascript code and it is not working for me !
I try to place an image at a div. What that image would be it depends on a parameter I send to a js function.
This is what my HTML page:
Code:
<!DOCTYPE html>
<!--to-forum.html-->
<html lang = "he">
<head>
<title>js</title>
<meta charset="utf-8" />
<script>
function ChangeImage(xx)
{
if(xx=='1')
{
return("../images/greensilver.gif");
}
if(xx=='2')
{
return("../images/greensilver1.gif");
}
}
</script>
</head>
<body>
<div id="logo">
<img id="myImg" src="ChangeImage('1')" />
</div>
</body>
</html>
Could anyone instruct me how to do it right ?
Thanks