Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > question about putting variable in style change script

Reply
Thread Tools

question about putting variable in style change script

 
 
insideview@gmail.com
Guest
Posts: n/a
 
      10-13-2006
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?

 
Reply With Quote
 
 
 
 
Dag Sunde
Guest
Posts: n/a
 
      10-13-2006
<(E-Mail Removed)> skrev i melding
news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      10-13-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rails console output shows "\n" rather than putting in new line? isthere a way to change this? Greg Hauptmann Ruby 5 01-20-2009 10:47 PM
Opera won't change the style information when I change classname torbs Javascript 2 05-02-2006 07:29 AM
Putting code in a variable and running interactively? Jimmy Phillips Perl 2 08-25-2004 04:49 PM
Difference between putting code in constructor and putting code in static{} Saurabh Java 6 05-30-2004 02:44 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM



Advertisments