Closed Thread Icon

Topic awaiting preservation: stupid damn Javascript! (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=8261" title="Pages that link to Topic awaiting preservation: stupid damn Javascript! (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: stupid damn Javascript! <span class="small">(Page 1 of 1)</span>\

 
Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-14-2002 23:34

Why doesn't this work?

~Castle being the DIV~

document.getElementByID("castle").style.posleft = event.clientX;

{edit}Tried this:

var lastLeft = event.clientX;
castle.style.posleft = lastLeft;

seems to be better style, but still don't work...

{edit2} and 'pixelLeft' seems to be the way to go... but alass, no movement...


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

[This message has been edited by Petskull (edited 08-14-2002).]

[This message has been edited by Petskull (edited 08-14-2002).]

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 08-15-2002 00:14

Is the castle div set to position: absolute? And did you already try .style.left? If you're using Mozilla, you might also have to add +"px" to the value.

kuckus (cell #282)

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-15-2002 00:20

you know.... I coulda sworn that castle.style.left was the first thing I tried, anywayz, it did the trick... thanks, man..

{edit} and by the way, 'yes' to position:absolute; and I'm using IE5..


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

[This message has been edited by Petskull (edited 08-15-2002).]

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 08-15-2002 01:06

Glad it worked

kuckus (cell #282)

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 08-15-2002 01:24

Though you already found an alternative solution, I think it's worth you now that was a case error.
it's document.getElementById("castle").style.posleft = event.clientX;

BTW, if you wish to get this script working in any Standard Compliant browser, you should get rid of the posLeft and posTop thingy and use position="absolute" and set the left and top propeties ( it's no use to precise "px" 'cause it's the defaut unit )

Hope that helps,

Mathieu "POÏ" HENRI

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-15-2002 03:50

yeah, but I'm trying to make it dynamic...


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 08-15-2002 04:48

what are you trying to make dynamic ?
'coz nothing forbids you to "document.getElementById()" with a variable instead of an id.

Mathieu "POÏ" HENRI

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 08-15-2002 15:10

'stupid damn javascript'

interesting way to look at the problem

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-15-2002 19:47

yeah, it was one of those "If I turn up the radio, the noise from the motor goes away" situations... I find, if I blame it on the Javascript, my mental stamina endures long enough to solve the problem. Neat, huh?!


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-15-2002 19:50

btw, I meant the dynamicy statement in response to this phrase:

quote:
and use position="absolute" and set the left and top propeties ( it's no use to precise "px" 'cause it's the defaut unit )



I thought you were suggesting to embed to values into the style sheet.


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

« BackwardsOnwards »

Show Forum Drop Down Menu