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

这段语句咋总报错?错在哪里了?
<head>
<script type="text/javascript">
function mouseOver(id, pic)
{
document.getElementById(id).src = pic
}
function mouseOut(id, pic)
{
document.getElementById(id).src = pic
}
</script>

</head>

<a target="_blank" href="mailto:support@xxxxxxxx.com">
<img border="0" id="img1" src="e1.png" height="32" width="32" alt="" onmouseover=mouseOver("img1", "e1.png") onmouseout=mouseOut("img1", "e0.png")></a>

<a target="_blank" href="https://twitter.com/xxxxxxxx">
<img border="0" id="img2" src="t0.png" height="32" width="32" alt="" onmouseover=mouseOver("img2", "t1.png") onmouseout=mouseOut("img2", "t0.png")></a>

------解决方案--------------------
<html>
<head>
    <script type="text/javascript">
        function mouseOver(id, pic)
        {
            document.getElementById(id).src = pic
        }
        function mouseOut(id, pic)
        {
            document.getElementById(id).src = pic
        }
    </script>

</head>
<body>
    <a target="_blank" href="mailto:support@xxxxxxxx.com">
        <img border="0" id="img1" src="e1.png" height="32" width="32" alt="" onmouseover='mouseOver("img1", "e1.png")'onmouseout='mouseOut("img1", "e0.png")'></a>

        <a target="_blank" href="https://twitter.com/xxxxxxxx">
            <img border="0" id="img2" src="t0.png" height="32" width="32" alt="" onmouseover='mouseOver("img2", "t1.png") 'onmouseout='mouseOut("img2", "t0.png")'></a>
</body>
</html>

onmouseover='方法()‘; 方法需要引号引起来