2012-05-11 26 views
1

我嘗試使用下面的代碼jQuery的顏色框添加到我的網頁:彩盒錯誤在IE「對象不支持此屬性或方法」

<!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> 
    <link rel="stylesheet" href="colorbox.css" /> 
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
    <script type="text/javascript" src="jquery.colorbox-min.js"></script> 
</head> 
<body> 
    <script type="text/javascript"> 
     $(function() 
     { 
      $(".popup") 
      .colorbox({iframe:true, innerWidth:695, innerHeight:340, overlayClose:false }); 

     }) 
    </script> 
    <a class='popup' href='http://www.bbc.co.uk'>bbc.co.uk</a> 
</body> 

它同時適用於火狐和鉻。但是當我在IE7中運行它時,出現以下錯誤:

Object doesn't support this property or method

任何幫助都會很棒。

+0

JavaScript文件是否正確加載? – epascarello

+0

是啊所有的JavaScript文件已經正確加載 –

+0

你正在加載什麼版本的jquery? – emd

回答

0

很有可能您的<script>標記無效或包含的類型屬性設置爲text/javascript以外的其他值。

沒有看到代碼的一部分,我們無法弄清楚到底發生了什麼問題。

更多信息

腳本標籤必須有一個結束</script><script />不適用於所有瀏覽器。

此外,type屬性必須是text/javascript或不存在。如果它是application/javascript某些版本的IE將不會執行它。

+0

我所有的

+0

是否有任何其他標記無效?如果一個瀏覽器與標籤無關,沒有理由對此產生窒息。它不會是一個JavaScript錯誤,除非有更多的錯誤發生,你沒有通知我們。 –

+0

我很快做出了一個空白的網頁,只是與彈出窗口,仍然有問題,即 –

相關問題