-1

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!

jorrebor
  • 2,166
  • 12
  • 48
  • 74
  • 1
    you could try [ie7-js](http://code.google.com/p/ie7-js/), which help standardise IE's HTML/CSS support –  Oct 26 '11 at 10:54
  • 2
    See http://stackoverflow.com/questions/7892509/is-there-a-way-to-log-to-console-without-breaking-code-under-ie – Alex K. Oct 26 '11 at 10:55
  • _"does not work"_ - and nothing happens, or something happens but not what you expected, or you get an error message, or...? (EDIT: OK, so it'll be the console.log() problem.) – nnnnnn Oct 26 '11 at 10:56
  • possible duplicate of ['console' is undefined error for internet explorer](http://stackoverflow.com/questions/3326650/console-is-undefined-error-for-internet-explorer) – skolima Oct 26 '11 at 13:21

1 Answers1

4

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.

EricLaw
  • 56,563
  • 7
  • 151
  • 196
Moin Zaman
  • 25,281
  • 6
  • 70
  • 74
  • It works, you just need to open the Console in Developer Tools while the script's running. – duri Oct 26 '11 at 10:56