Closed Thread Icon

Topic awaiting preservation: Object Required after adding BODY OnLoad event Pages that link to <a href="https://ozoneasylum.com/backlink?for=8754" title="Pages that link to Topic awaiting preservation: Object Required after adding BODY OnLoad event" rel="nofollow" >Topic awaiting preservation: Object Required after adding BODY OnLoad event\

 
Author Thread
KirbyWallace
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 07-14-2003 09:38

My HTML page has lots of elements (usually rows) with "onMouseOver" events. The OnMouseOver events just swap style classes to make "hover" colors change, and whatnot. ie, ...onMouseOut="this.className='YellowRowOff'"...Very simple, and has worked just fine since forever.

That is, until I changed my Body tag from:

<BODY>

to:

<BODY OnLoad='vbscript:MsgBox("Hello")'>

Adding that MsgBox worked just fine. I get my "Hello" dialog.

BUT, now every single one of my "OnMouseOver" events are failing with an "Object Required" on the "this" object.

My suspicion is that "this.classname..." is a javascript construct, and before now it always saw it and defaulted the language to javascript. Then specifically adding an inline VBScript statement in my BODY tag changed the default language to VBScript, causing the browser to attempt to interpret the "this.classname..." statement as VBScript instead of Javascript, with havoc ensuing...

Any ideas? Am I on the right track or is it something completely different?



mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 07-14-2003 09:59

I suggest you not to mix JavaScript and VBScript (especially since VBScript works only in IE). Your MsgBox() call can simply be replaced with JavaScript alert() function...


« BackwardsOnwards »

Show Forum Drop Down Menu