<!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>
本意是想:点击按钮后,按钮的图片改变
但是实际情况:没反应

解决方案 »

  1.   

    <!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";
    return false;
    }
    </script>
    </head><body>
    <form id="zck" onsubmit="return fn()">
    <input type="image" src="dzt.jpg">
    </form>
    </body>
    </html>
      

  2.   

    楼上帮我看下:我的代码有点小问题:
    <!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" src="http://s.syyx.com/nycs/js/jquery-1.6.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("#zck").click(function(){
    $(":image").attr("src","image/2.jpg");
    alert("11111");
    })
    })
    </script>
    </head><body>
    <form id="zck" >
    <input type="image" src="image/1.jpg">
    </form>
    </body>
    </html>
    点了图片1  跳转到图片2 又跳转到图片1了
    这是啥原因啊
    哪里没注意到
      

  3.   

    <!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" src="http://s.syyx.com/nycs/js/jquery-1.6.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("#zck").click(function(){
    $(":image").attr("src","zhuce_text.jpg");
    return false;
    })
    })
    </script>
    </head><body>
    <form id="zck" >
    <input type="image" src="dzt.jpg">
    </form>
    </body>
    </html>
    ============
    楼主这样好了,可以用
      

  4.   


    <!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>
    默认就提交 所以看不着效果,加个return