IE6(ie6) ScrollPic未定的解决方法
2014-08-13来源:易贤网

图片滚动代码,ie6下运行后出现ScrollPic未定义。

可能原因:ScrollPic.js文件的编码和调用这个文件的文件编码不一致所致

解决方法:将两个文件编码统一。

例:pic.html

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title></title>

<script type="text/javascript" src="ScrollPic.js"></script>

</head>

<body>

...

</body>

</html>

ScrollPic.js

var sina={$:function(objName){if(document.getElementByIdx_x){returneval_r('document.getElementByIdx_x("'+objName+'")')}else{returneval_r('document.all.'+objName)}},isIE:navigator.appVersion.indexOf("MSIE")!=-1?true:false,addEvent:function(l,i,I){if(l.attachEvent){l.attachEvent("on"+i,I)}else{l.addEventListener(i,I,false)}},delEvent:function(l,i,I){if(l.detachEvent){l.detachEvent("on"+i,I)}else{l.removeEventListener(i,I,false)}},readCookie:function(O){varo="",l=O+"=";if(document.cookie.length>0){var i=document.cookie.indexOf(l);if(i!=-1){i+=l.length;varI=document.cookie.indexOf(";",i);if(I==-1)I=document.cookie.length;o=unescape(document.cookie.substring(i,I))}};returno},writeCookie:function(i,l,o,c){var O="",I="";if(o!=null){O=new Date((newDate).getTime()+o*3600000);O="; expires="+O.toGMTString()};if(c!=null){I=";domain="+c};document.cookie=i+"="+escape(l)+O+I},readStyle:function(I,l){if(I.style[l]){return I.style[l]}else if(I.currentStyle){return I.currentStyle[l]}elseif(document.defaultView&&document.defaultView.getComputedStyle){vari=document.defaultView.getComputedStyle(I,null);return i.getPropertyValue(l)}else{return null}}};

//滚动图片构造函数

//UI&UE Dept. mengjia

//080623

function ScrollPic(scrollContId,arrLeftId,arrRightId,dotListId){..}

将ScrollPic.js文件打开,修改将文档编码改为UTF-8

完成!!!

更多信息请查看IT技术专栏

推荐信息