简体   繁体   English

我需要什么才能在Internet Explorer中使用JavaScript?

[英]What do i need to get javascript working in Internet Explorer?

this javascript does not work on IE 8, in chrome and firefox it does. 此javascript在chrome和firefox上的IE 8上不起作用。

The complete site is found here 完整的网站在这里找到

<script type="text/javascript">

function get_random()
{
    var ranNum= Math.floor(Math.random()*35);
    return ranNum;
}

function pickBG(){

    var i = 1 + get_random();
    console.log(i);
    document.body.style.backgroundImage="url('/pand_89/CI/images/bgSet/" + i + ".jpg')";
}

DO i need a different doctype or something? 我是否需要其他文档类型或其他内容?

Thanks! 谢谢!

console.log() does not work in IE unless the F12 console is open. 除非打开F12控制台,否则console.log()在IE中不起作用。 Remove it or check to see if the console object is defined before using it. 删除它,或在使用它之前检查控制台对象是否已定义。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM