Click here to get back home

using vars in div style tag

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
using vars in div style tag ScooterMX 01-05-2005
Get Chitika Premium
Posted by ScooterMX on January 5, 2005, 4:32 pm
Please log in for more thread options
I have a menu that stretches across the top of a series of pages, and I need
to be able to change all 8 div's absolute position. Here's a snippet of the
code I am
using:

<div id="layer1" style="position:absolute; width:auto; height:auto; top:1px;
left:50px">

What I need is to be able to change that 'left:50px' to the equiv of
"left:layer1_pos">

any suggestions on how to go about this??






Posted by Harlan Messinger on January 5, 2005, 11:40 am
Please log in for more thread options

> I have a menu that stretches across the top of a series of pages, and I
need
> to be able to change all 8 div's absolute position. Here's a snippet of
the
> code I am
> using:
>
> <div id="layer1" style="position:absolute; width:auto; height:auto;
top:1px;
> left:50px">
>
> What I need is to be able to change that 'left:50px' to the equiv of
> "left:layer1_pos">
>
> any suggestions on how to go about this??

You need to be using a server technology like ASP, ASP.NET, Java servlets,
PHP, CGI, et al., that generates HTML pages programmatically.



Posted by ScooterMX on January 5, 2005, 6:04 pm
Please log in for more thread options

>
> > I have a menu that stretches across the top of a series of pages, and I
> need
> > to be able to change all 8 div's absolute position. Here's a snippet of
> the
> > code I am
> > using:
> >
> > <div id="layer1" style="position:absolute; width:auto; height:auto;
> top:1px;
> > left:50px">
> >
> > What I need is to be able to change that 'left:50px' to the equiv of
> > "left:layer1_pos">
> >
> > any suggestions on how to go about this??
>
> You need to be using a server technology like ASP, ASP.NET, Java servlets,
> PHP, CGI, et al., that generates HTML pages programmatically.
>

This is on an .asp page. And actually any page that can render css can do
this, not just server side. css/dhtml is a client side rendering.

What I need to figure out is how to access the layers properties, or more
accurately, WHEN to. I think that I can set the div's stlye tag like this:

document.layer1.left=50

but I'm not sure when to do that, syntax-wise...




Posted by Harlan Messinger on January 5, 2005, 1:34 pm
Please log in for more thread options

>
> >
> > > I have a menu that stretches across the top of a series of pages, and
I
> > need
> > > to be able to change all 8 div's absolute position. Here's a snippet
of
> > the
> > > code I am
> > > using:
> > >
> > > <div id="layer1" style="position:absolute; width:auto; height:auto;
> > top:1px;
> > > left:50px">
> > >
> > > What I need is to be able to change that 'left:50px' to the equiv of
> > > "left:layer1_pos">
> > >
> > > any suggestions on how to go about this??
> >
> > You need to be using a server technology like ASP, ASP.NET, Java
servlets,
> > PHP, CGI, et al., that generates HTML pages programmatically.
> >
>
> This is on an .asp page. And actually any page that can render css can do
> this, not just server side. css/dhtml is a client side rendering.
>
> What I need to figure out is how to access the layers properties, or more
> accurately, WHEN to. I think that I can set the div's stlye tag like
this:
>
> document.layer1.left=50
>
> but I'm not sure when to do that, syntax-wise...

OK, I understand now. Since you had put this in an HTML group, I had assumed
it was an HTML question and that you didn't realize this couldn't be done
through HTML. The answer is

document.getElementById("layer1").style.left = 50;



Posted by Leif K-Brooks on January 6, 2005, 6:41 am
Please log in for more thread options
ScooterMX wrote:
> I have a menu that stretches across the top of a series of pages, and
> I need to be able to change all 8 div's absolute position.Here's a
> snippet of the code I am using:

> <div id="layer1" style="position:absolute; width:auto; height:auto;
> top:1px; left:50px">

Remove the inline style attribute from the DIVs, add this to the pages'
HEAD element:

<link rel="stylesheet" type="text/css" href="style.css">

Then create a file called style.css and put this in it:

#layer1 {
position: absolute;
width: auto;
height: auto;
top: 1px;
left: 50px;
}


Similar ThreadsPosted
XHTML DOCTYPE breaks JavaScript x.style.top and x.style.left? July 5, 2005, 12:58 pm
TR's w no Style? October 5, 2005, 4:27 pm
style=& ? November 22, 2004, 7:24 am
Footnote style September 25, 2005, 8:38 pm
OL tag with style for decrementing? February 28, 2007, 1:09 am
image alt style pop up for text August 6, 2004, 8:25 am
Style absolute positioning October 25, 2004, 12:14 pm
z-index style not working December 21, 2004, 2:36 pm
style to remove all styles March 25, 2005, 5:09 am
Style Sheet Woes June 23, 2005, 1:54 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap