javascript - 如何使用 javascript 或 html 为我的网站制作跨浏览器友好的文本轮播?

标签 javascript internet-explorer firefox browser carousel

如何使用 Javascript 或 html 为我的网站制作跨浏览器友好的文本轮播?我一直在努力处理下面的代码,因为它只适用于 Firefox,但在 IE 上失败。有没有办法让它同时适用于两者?

<h4>Carousel-Text-Below </h4>

<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'    
type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function(){
function setRandomWord(){
    var phrases =new Array("1-Blah Text","2-Blah Text","3-Blah Text");  
    $("#test").text(phrases[Math.floor(Math.random()*phrases.length)]);
}
setInterval(setRandomWord,3000);
});
</script>
</head>
<body> 
<p style="border:1px dashed gray; background-color:white; padding: 10px">
<span id='test'>Blah Text-Text-Text</p>
</span> Guaranteed Service or...Text---Text</strong></p> 
</body> 
</html>

最佳答案

我认为这是因为您没有设置文档类型。在这里尝试过,它适用于 <!DOCTYPE html><html>前面标签。

关于javascript - 如何使用 javascript 或 html 为我的网站制作跨浏览器友好的文本轮播?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14308748/

相关文章:

javascript - 如何在不显示原始引荐来源网址的情况下进行重定向?

javascript - 如何计算同一页面中某个类的出现次数,然后在目标元素中显示实际出现的次数

css - WebDriver - ":nth-of-type()"选择器是否适用于 IE 9?

firefox - Firefox 扩展在 Mac OS 中的位置?

javascript - JavaFx WebView 等待 Java 方法完成

CSS 菜单在 IE 8 及更低版本中不起作用

html - 页面在 Chrome 和其他浏览器上看起来不错,但在 Internet Explorer 上它在我的图像之间增加了空间负载?

html - 使用元标记防止 Firefox 在刷新时记住输入值

firefox - 附加组件、插件和扩展之间的确切区别

javascript - 带有内插折线图的谷歌图表