简体   繁体   中英

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.

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. Remove it or check to see if the console object is defined before using it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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