<img src="A" onclick="this.src='B';">

解决方案 »

  1.   

    用js吧。
    <!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 goChange()
            {
                var imgList = new Array();
                imgList[0] = "1.jpg";
                imgList[1] = "2.jpg";
                
                var obj, t, path;
                obj = document.getElementById("img1");
                t = obj.src.lastIndexOf("/");
                path = obj.src.substring(t + 1);
                if(path == imgList[0])
                    obj.src = imgList[1];
                else if(path == imgList[1])
                    obj.src = imgList[0];
            }
        </script>
    </head>
    <body>
        <div id="cc">
            <img id="img1" src="1.jpg" alt="" title="点击我将更换图片噢" onclick="goChange()" />
        </div>
    </body>
    </html>主要工作就是在图片的onclick事件中,修改img对象的src属性