2010-05-02 95 views
3

IE 8每次运行我的网站时都会阻止我的自定义脚本,而我需要点击“允许脚本”才能正确运行它。它无聊。IE阻止脚本

任何想法?

脚本:

// JavaScript Document 
var char=0; 
var caption = ""; 
var standby; 

var msg = "Lorem ipsum dolor sit amet, consenctuinv isdrulix core"; 


var selectedItem = 1; 
var lastItem; 
    var fotos = new Array(); 
    fotos[0] = "Img/Dela/wan_crowd2.jpg" 
    fotos[1] = "Img/Dela/wan_dog.jpg"; 
    fotos[2] = "Img/Dela/wan_spirit.jpg" 
    fotos[3] = "Img/Dela/wan_pose_bra.jpg"; 
    fotos[4] = "Img/Dela/wan_crowd2.jpg" 
    var interval; 
$(function(){ 
      //Main rotator ---------------------------------------------------------------------------------------- 
      if($("#mainPhoto").html() == ""){ 
       $("#mainPhoto").html($("<img></img>").attr({src:fotos[1]})); 
       $(".control:first").css({color:"#fff",background:"none"}); 
       selectedItem = 2; 
       lastItem = 1; 
       ShowCaption(null); 
      } 
      interval = setInterval("AutoRotate()",5000); 
      $(".control,#mainPhoto").hover(function(){ 
             clearInterval(interval); 
             },function(){ 
             interval = setInterval("AutoRotate()",5000);         
              }); 
      $(".control").click(function(){ 
             var idFoto = $(this).text(); 
             $("#runnerDiv").css("background","url(" + fotos[(selectedItem - 1)] + ") no-repeat top left"); 
             $("#mainPhoto").html($("<img></img>").attr({src:fotos[parseInt(idFoto)]}).css({width:"407px",height:"289px",display:"none"}).fadeIn(1500)); 

             $(this).parent().nextAll().find("a").css({color:"#e4065d",backgroundColor:"#fff"}); 
             $(this).parent().prevAll().find("a").css({color:"#e4065d",backgroundColor:"#fff"}); 

             $(this).css({color:"#fff",background:"none"}); 

             lastItem = idFoto; 
             if((parseInt(idFoto) + 1) <= 4) 
             selectedItem = (parseInt(idFoto) + 1); 
             else 
             selectedItem = 1; 
              ShowCaption(null); 

             }); 
      //end main rotator -------------------------------------------------------------------------------- 
      $("#perfilWrapper ul li").hover(function(){ 
                 $(this).css("z-index","10"); 
                  $(this).find("img").css("background","#c9c").stop().animate({ 
                                 width:"113px", 
                                 height:"85px", 
                                 left:'-20px', 
                                 top:'-50px' 
                                 },200); 
                 },function(){ 
                  $(this).css("z-index","0"); 
                     $(this).find("img").css("background","#f0f0f0").stop().animate({ 
                                 width:"54px", 
                                 height:"40px",                                                             left:'0', 
                                 top:'0' 
                                 },500);            
                  }); 

      }); 
function AutoRotate(){ 
    var controles = $(".control"); 
    $("#runnerDiv").css("background","url(" + fotos[(selectedItem - 1)] + ") no-repeat top left"); 
    $("#mainPhoto").html($("<img></img>").attr({src:fotos[selectedItem]}).css({display:"none"}).fadeIn(1500)); 
    var colorName = ""; 
    var numColor = parseInt(lastItem); 
    switch(numColor) 
    { 
     case 1: 
     colorName = "#0c3"; 
     break; 
     case 2: 
     colorName = "#3AABE7"; 
     break; 
     case 3: 
     colorName = "#EAC900"; 
     break; 
     case 4: 
     colorName = "#A203FD"; 
     break; 
    } 
    controles.filter(function(){return $(this).text() == selectedItem.toString();}).css({color:"#fff",background:"none"}); 

      $("#mainPhoto").attr("href","home.aspx?id=" + selectedItem);//link das imagens 
    if(lastItem != null) 
    { 
     controles.filter(function(){return $(this).text() == lastItem.toString();}).css({color:colorName,background:"#fff"}); 
    } 
    lastItem = selectedItem; 
    if(selectedItem <= 3){ 
    selectedItem++; 
    } 
    else 
    selectedItem = 1; 

    ShowCaption(null); 
    } 
function ShowCaption(obj){ 
    caption = msg; 
    if(caption){ 
     type(); 
    } 
} 

function type(){ 
    $("#textControl").html(caption.substring(0,char++));   
    if(char < caption.length + 1){ 
     setTimeout("type()",10); 
    } 
    else 
    { 
     char = 0; 
     caption =""; 
    } 
} 
+0

你在本地或互联网上运行该网站的区域是?你能提供一个链接到你的网站或给我们一些线索,你的脚本可能在做什么? – 2010-05-02 18:59:38

+0

其本地,我不能这样做 – ozsenegal 2010-05-02 19:02:14

+0

你检查了工具 - > Internet选项 - >安全 - >自定义级别下的所有内容吗? – Chris 2010-05-02 19:11:42

回答

2

,如果它在本地通过文件系统直接提供服务(而不是通过本地Web服务器),IE8将防止许多脚本被执行,因为恶意脚本可以做更多的伤害这样。