日期:2014-05-16  浏览次数:20539 次

JAVASCRIPT问题求助,在线等!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function fn()
{var x=document.getElementsByTagName("input");
x[0].src="zhuce_text.jpg";
}
</script>
</head>

<body>
<form id="zck" onsubmit="fn()">
<input type="image" src="dzt.jpg">
</form>
</body>
</html>


本意是想:点击按钮后,按钮的图片改变
但是实际情况:没反应

------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function fn()
{var x=document.getElementsByTagName("input");
x[0].src="http://avatar.profile.csdn.net/7/5/E/2_dazitou123.jpg";
return false;
}
</script>
</head>

<body>
<form id="zck" onsubmit="return fn()">
<input type="image" src="dzt.jpg">
</form>
</body>
</html>