我正在尝试使用以下代码将 jquery colorbox 添加到我的网页:
<!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>
它适用于 Firefox 和 Chrome。但是当我在 IE7 中运行它时,出现以下错误:
Object doesn't support this property or method
任何帮助都会很棒。
最佳答案
您很可能有 <script>
标签无效或包含设置为 text/javascript
以外的类型属性.
如果没有看到那部分代码,我们就无法弄清楚到底出了什么问题。
更多信息
脚本标签必须有结束 </script>
。 <script />
不适用于所有浏览器。
此外,type
属性必须是 text/javascript
或不存在。如果是application/javascript
某些版本的 IE 不会执行它。
关于javascript - IE 中的 ColorBox 错误 "Object doesn' 不支持此属性或方法”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10553891/