我正在尝试通过单击图像来调用 javascript,但它不起作用。
请参阅下面的代码。
Javascript
<script type="text/javascript">
<!--
var image1=new Image()
image1.src="images/Image_1.png"
var image2=new Image()
image2.src="images/Image_2.png"
var image3=new Image()
image3.src="images/Image_3.png"
//-->
function login(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible";
}else if(showhide == "hide"){
document.getElementById('popupbox').style.visibility="hidden";
}
}
</script>
我的代码
<div id="apDiv21"><img src="images/Login_OnOut.png" width="71" height="44"
onmouseover="this.src='images/Login_OnRollover.png'"
onmouseout="this.src='images/Login_OnOut.png'" onclick="login('show');" />
<div id="popupbox">
<form name="login" action="" method="post" style="background-color:#C7C7C7">
<center>Username:</center>
<center><input name="username" size="14" /></center>
<center>Password:</center>
<center><input name="password" type="password" size="14" /></center>
<center><input type="submit" name="submit" value="login" /></center>
</form>
<center><a href="login('hide');">close</a></center>
</div>