View Full Version : IE weird javascript console ...

07-09-2005, 02:58 PM
In IE 6 WIN I got a js console error message saying that an object is expected when writng the script like this:

<script type="text/javascript">
unhideAllDivs ();

In IE 6 WIN doing this no js errors any more

<script type="text/javascript">
var document.getElementById('largeImage') = 'largeImg' ;
unhideAllDivs ();

What caused the error in the version without the declared var in IE 6 WIN ?
Is there a better way to write this?

07-09-2005, 05:17 PM
answered wrong post

07-09-2005, 05:31 PM
best try and say somthing after above

but I have no idea what

var document.getElementById('largeImage') = 'largeIm' ;

is trying to achieve

but if you are trying to load a large image

this will change the image if it is found
but probably before its loaded

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


<script language="JavaScript" type="text/javascript">

function PreLoad(){
largeIm=new Image();
largeIm.onload=function(){ document.getElementById('largeImage').src=largeImg.src; unhideSmalDivs (); }




07-09-2005, 06:00 PM
No, this code snippet is to execute the script unhideAllDivs AFTER the image with id=largeImage has loaded.

My question was if it makes any difference if I would declare a variable

var largeImg = document.getElementbyId('largeImage');.

The javascript console that popped up in IE6 WIN XP gave an error saying object wass missing so that is why I put in an extra line to declare the var.

Will the var be set to null by itself after execution of the function?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum