2012-05-21 209 views
0

我有一些在我的主頁上循環的感言,並且代碼似乎在Firefox,Chrome和Safari中運行得很好,但在IExplorer中卻沒有。我正在運行IE 9.我很感激任何幫助或見解。Javascript無法在IE瀏覽器中運行,但所有其他瀏覽器都正常工作

下面是我使用的代碼:

<div class="quotes"> 
    <div id="tst"> 
     <div id="quote"></div> 
    </div> 
    <br><span></span> 
</div> 
<div class="comment"><strong> 
    <div id="tstperson"></div></strong> 
</div> 
<script type="text/javascript"> 
    var quote=new Array(); 
     quote[0]="An essential tool in preparation for any show. Valuable time is saved, refining vocals much earlier in the process."; 
     quote[1]="Invaluable for learning vocal lines! A brilliantly simple and easy to use interface that saved me hours of time."; 
     quote[2]="MixMyPart saved us almost a week of rehersal time. A brilliant invention. Singers come in less nervous and more focused."; 
    <!-- quote[3]="An invaluble tool for learning vocal lines! Brilliantly simple and easy to use interface that saved me hours of time."; 
    --> 

    var quoteperson=new Array(); 
     quoteperson[0]="Bob Foster, <font color=\"ffffff\">Music Director</font>"; 
     quoteperson[1]="Liam Tobin, <font color=\"ffffff\">Actor</font>"; 
     quoteperson[2]="Shawn Wright, <font color=\"ffffff\">Actor</font>"; 
    <!-- quoteperson[3]="Liam Tobin, <a href=\"website.html\" target=\"_blank\">website.org</a>";  
    --> 

    var speed=7000; 
    var q=Math.floor(Math.random()*quote.length) 

    function showQuote() { 
     document.getElementById("tst").innerHTML="&ldquo;"+quote[q]+"&rdquo;"; 
     document.getElementById("tstperson").innerHTML=quoteperson[q]; 
     q++; 
    if(q==quote.length) { 
     q=0; 
     } 
    } 
    showQuote(); 
    setInterval('showQuote()',speed); 
</script> 
+1

您是否收到任何錯誤? – j08691

+2

「不工作」是什麼意思?它在做什麼? –

回答

6
<!-- --> 

是不是一個有效的JavaScript評論。使用/ * * /來代替。

0

您的評論標記對javascript無效。如下修改您的腳本,它在IE中正常工作:

var quote=new Array(); 
    quote[0]="An essential tool in preparation for any show. Valuable time is saved, refining vocals much earlier in the process."; 
    quote[1]="Invaluable for learning vocal lines! A brilliantly simple and easy to use interface that saved me hours of time."; 
    quote[2]="MixMyPart saved us almost a week of rehersal time. A brilliant invention. Singers come in less nervous and more focused."; 
// quote[3]="An invaluble tool for learning vocal lines! Brilliantly simple and easy to use interface that saved me hours of time."; 

var quoteperson=new Array(); 
    quoteperson[0]="Bob Foster, <font color=\"ffffff\">Music Director</font>"; 
    quoteperson[1]="Liam Tobin, <font color=\"ffffff\">Actor</font>"; 
    quoteperson[2]="Shawn Wright, <font color=\"ffffff\">Actor</font>"; 
// quoteperson[3]="Liam Tobin, <a href=\"website.html\" target=\"_blank\">website.org</a>"; 
相關問題