2010-05-02 99 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將防止許多腳本被執行,因爲惡意腳本可以做更多的傷害這樣。