单击图像时,我试图将变量发送到函数,但无法使其任何工作。不知道我哪里错了。?
jsfiddle http://jsfiddle.net/cibravo/rNGMR/
HTML
<input type="submit" value="send" onclick="alert('works')" />
<br/><br/>
<img onclick="alert('works')" src="http://firmakurser.studieskolen.dk/images/web/Facebook-logo-small.png" />
<br/><br/>
<!-- this doesn't work -->
<input type="button" value="send" onclick="myFunction()" />
<br/><br/>
<!-- this doesn't work -->
<img onclick="showhide('works')" src="http://firmakurser.studieskolen.dk/images/web/Facebook-logo-small.png" />
JS
function myFunction(){
alert("works");
}
function showhide(field){
alert(field);
}