By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,565 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

question about putting variable in style change script

P: n/a
How do I do something, where

var x="-20%";

document.all("something").style.top=x
normally, this would work --

document.all("something").style.top='-20%';

but the above formulation doesn't..... is there some diff way?

Oct 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<in********@gmail.comskrev i melding
news:11**********************@b28g2000cwb.googlegr oups.com...
How do I do something, where

var x="-20%";

document.all("something").style.top=x
normally, this would work --

document.all("something").style.top='-20%';

but the above formulation doesn't..... is there some diff way?
try:

var x="-20%";

document.all("something").style.top= "'" + x + "'";

--
Dag.
Oct 13 '06 #2

P: n/a
in********@gmail.com wrote:
How do I do something, where

var x="-20%";

document.all("something").style.top=x
Provided the browser in question supports document.all, the above
"works".

Do no use document.all in isolation (or at all if IE 4 support is not
required), use document.getElementById with appropriate feature
detection.

<URL: http://www.jibbering.com/faq/#FAQ4_26 >

normally, this would work --

document.all("something").style.top='-20%';

but the above formulation doesn't..... is there some diff way?
It does work. You may not be getting the result you want, but that is
a question for a CSS group, not here.

news:comp.infosystems.www.authoring.stylesheets
<URL:
http://groups.google.com.au/group/co...s?lnk=li&hl=en
>

--
Rob

Oct 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.