图像显示不正确

时间:2012-08-28 20:53:18

标签: php javascript web

我在suffusion-subscription.php中添加了自定义代码,以便在鼠标悬停在图像上时更改Facebook图标的图像。

在初始加载期间,不显示任何图像。之后,mouseHover和mouseOut事件显示适当的图像,但不显示初始加载。

下图显示了问题:

enter image description here

JavaScript的:

//preload images:
fb1 = new Image(64,64);
fb1.src = "http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Facebook-04.png";
fb2 = new Image(64,64);
fb2.src = "http://sohamshah.com/wordpress/wp-content/uploads/2011/11/fb-broken.png";

//image swapping function:
function hiLite(imgDocID, imgObjName, comment) {

document.images[imgDocID].src = eval(imgObjName + ".src");
window.status = comment; return true;
}

</script>

HTML:

<div class='fix'>
    <a href="http://feeds.feedburner.com/sohamshah" class="follow-icon-and-tag" title="RSS">
        <img src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/RSS-13.png" alt="RSS" style='width: 64px; height: 64px;' />
    </a>
    <a href="http://www.facebook.com/soham100" onMouseOver="hiLite('fb','fb2','Follow Me on FaceBook')"  onMouseOut="hiLite('fb','fb1','')" class="follow-icon-and-tag" title="Facebook">
        <img name="fb" "src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Facebook-04.png" alt="Facebook" style='width: 64px; height: 64px;' />
    </a>

  <a href="http://twitter.com/sohamshah" class="follow-icon-and-tag" title="Twitter">
            <img src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Twitter-08.png" alt="RSS" style='width: 64px; height: 64px;' />
        </a>

   </div>

对此事的任何帮助将不胜感激。

Soham

1 个答案:

答案 0 :(得分:2)

图片代码中的src旁边有一个额外的双引号。