JavaScript and client side scripting.
Moderator: General Moderators
Kaervek
Forum Commoner
Posts: 25 Joined: Fri Jul 08, 2005 7:17 am
Location: Newfoundland
Contact:
Post
by Kaervek » Mon Mar 19, 2007 8:16 am
...and it aint working!
like why wont simply this code work?
Code: Select all
<div align="center" id="moolayer" style="position:absolute; left:0px; top:150px; width:200px; background-color:#0066FF;" window.onresize="MM_changeProp('moolayer','','style.left','500px','DIV')">MOO</div>
this works...
Code: Select all
<div align="center" id="moolayer" style="position:absolute; left:0px; top:150px; width:200px; background-color:#0066FF;" onmouseover="MM_changeProp('moolayer','','style.left','500px','DIV')">MOO</div>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 19, 2007 9:37 am
"window.onresize" is not a valid event for any object but windows.
You need to add your resize event code to the window, not the div.
Kaervek
Forum Commoner
Posts: 25 Joined: Fri Jul 08, 2005 7:17 am
Location: Newfoundland
Contact:
Post
by Kaervek » Mon Mar 19, 2007 11:00 am
ok any tips on how i could add the event to the window?
mikeq
Forum Regular
Posts: 512 Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland
Post
by mikeq » Mon Mar 19, 2007 11:05 am
put this into Google "window.onresize"
and I guarantee the first link will show you how.
Amazing eh?
Kaervek
Forum Commoner
Posts: 25 Joined: Fri Jul 08, 2005 7:17 am
Location: Newfoundland
Contact:
Post
by Kaervek » Mon Mar 19, 2007 11:24 am
dude... iv been scouring google all morning trying to figure this out... i never really searched for exactly window.onresize though, because i was looking for examples of how to position a div.
plus im really not good at javascript yet.
I think I should be able to get this working now tho
Kaervek
Forum Commoner
Posts: 25 Joined: Fri Jul 08, 2005 7:17 am
Location: Newfoundland
Contact:
Post
by Kaervek » Mon Mar 19, 2007 11:28 am
hmm
<object>.<event-name> = <function-name>
weird, i havent seen this kind of structure in any other language.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 19, 2007 11:39 am
It stems from the use of function pointers in C.