简体   繁体   English

Javascript无法在IE中运行,但所有其他浏览器都可以正常运行

[英]Javascript not working in IE, but all other browsers are working fine

I've got some testimonials that cycle on my home page and the code seems to be working just fine in Firefox, Chrome, and Safari but not in IExplorer. 我的主页上有一些推荐,这些代码在Firefox,Chrome和Safari中似乎可以正常工作,但在IExplorer中却不能正常工作。 I'm running IE 9. I'd appreciate any help or insights. 我正在运行IE9。不胜感激。

Here's the code I'm using: 这是我正在使用的代码:

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

is NOT a valid JavaScript comment. 不是有效的JavaScript注释。 Use /* */ instead. 使用/ * * /代替。

Your comment markup is not valid for javascript. 您的评论标记不适用于javascript。 Revise your script as follows, and it works properly in IE: 如下修改脚本,它可以在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>";   

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript无法在IE上运行,但在所有其他浏览器中都可以 - JavaScript not working on IE, but OK in all other browsers 滑动在IE中不起作用。 但它在所有其他浏览器中都可以正常工作 - Sliding is not working in IE . But it works fine in all other browsers jQuery .load在IE上不起作用(在所有其他浏览器上正常工作) - jQuery .load not working on IE (Works fine on all other browsers) 简单的javascript褪色效果在IE7 / 8中不起作用,在其他浏览器中效果很好 - Simple javascript fading effect not working in IE7/8, fine in other browsers javascript按钮在IE中不起作用; 在其他浏览器中工作 - Javascript button not working in IE; working in other browsers Ajax在下拉列表中无法在IE8中工作,但在其他浏览器中工作正常 - Ajax not working in IE8 on dropdown but it's working fine in other browsers keyup函数可以在所有浏览器上正常工作,但仅在IE中无法正常工作 - keyup function working fine with all browsers but only in IE its not working Flash菜单的Javascript未在IE9中加载,但在所有其他浏览器中都可以正常运行 - Javascript for flash menu not loading in IE9 but fine in all other browsers 单击事件在 IE 中不起作用,但在其他浏览器中工作正常 - Click event is not working in IE but works fine in other browsers onclick 功能在 IE 中不起作用,但在其他浏览器上工作正常 - The onclick function is not working in IE but works fine on other browsers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM