4
我創作了一個簡單的網站使用YUI來製作漂亮的動畫圖像畫廊。所有瀏覽器都能正常工作,但IE7。按照建議從雅虎服務器加載YUI。當我第一次加載頁面(或點擊F5刷新)時,一旦onload事件被調用,所有的圖像就消失。即使我根本不執行任何JavaScript,也不使用YUI庫 - 我的所有img標籤都不見了,並且不可見。但是,我仍然可以通過我的JavaScript代碼訪問它們,它並不會真的破壞我的代碼或拋出任何異常。加載YUI從服務器IE7圖像消失
這個問題也與CSS有部分關係 - 如果您嘗試註釋樣式標記,圖像不會再消失。
這些頁面的源代碼的部分仍然構成了複製這個問題網頁:
<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Title</title>
<style type="text/css">
body, div, table {font-family:Arial,Helvetica,Garuda,sans-serif; color:#777; font-size:14px;}
table {padding:0; margin:0; border-spacing:0;}
td {padding:0; margin:0}
img {border-style:none; padding:0}
#div-main {margin:0 auto; width:970px; position:relative; overflow:hidden}
#div-main-content {position:relative;}
#table-page-content {width:100%; height:374px;}
#td-main-image {vertical-align:top; width:609px; height:374px; padding:0px;}
img.img-main {width:609px; height:374px;}
#td-main-text {vertical-align:top; text-align:left; padding-right:40px;}
#div-gallery-container {width:609px; height:374px; overflow:hidden; position:relative;}
#div-gallery-content {position:absolute; top:0; left:0;}
#div-gallery-content div {width:609px; height:374px;}
#div-gallery-content img {width:609px; height:374px}
</style>
</head>
<body>
<div id="div-main">
<div id="div-main-content">
<table id="table-page-content">
<tr>
<td id="td-main-text">
some text
</td>
<td id="td-main-image" rowspan="1">
<div id="div-gallery-container">
<div id="div-gallery-content">
<div><img src="images/slideshow-01.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-02.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-03.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-04.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-05.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-06.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-07.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-08.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-09.jpg" class="img-main" alt="image" /></div>
<div><img src="images/slideshow-10.jpg" class="img-main" alt="image" /></div>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
<script src="http://yui.yahooapis.com/2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
<script src="http://yui.yahooapis.com/2.8.2r1/build/animation/animation-min.js" type="text/javascript"></script>
</body>
</html>
請幫我解決這個問題。
在圖像消失的版本:什麼是樣式屬性的圖像元素? (你可以通過檢查開發人員工具欄在ie7中查看這些元素,我相信) – ampersand 2011-05-03 23:14:10
經過多次測試後,它實際上顯示它不是YUI相關的,但是隻是另一個IE錯誤。然而,它正在運行JavaScript - 這就是爲什麼它在YUI加載時出現。 – Jakub 2011-05-05 22:22:00
嘗試把你的JavaScript的頭。你能附上一張圖片嗎? – breezy 2011-05-12 22:24:36