5 replies [Last post]
markw7
Offline
newbie
New Jersey
Last seen: 18 years 3 weeks ago
New Jersey
Joined: 2004-09-07
Posts: 4
Points: 0

Hey all. I'm using css (tweaked from ALA) for a nav bar which is pulled in by the id tag of the body. But I'm trying to set the body id tag from the head.

I tried...

<head>
<script>
var my_id="sectionone";
</script>
</head>

...and then...

<body id=my_id>

... but the styles are not being pulled in.

The reason why is so that the main portion of the body can be made uneditable in Dreamweaver. Any help is greatly appreciated.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 3 days 13 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

How to modify body css id tag in the head?

Hi markw7,
Have you tried<body onload="this.id=my_id" >

Hope that helps

markw7
Offline
newbie
New Jersey
Last seen: 18 years 3 weeks ago
New Jersey
Joined: 2004-09-07
Posts: 4
Points: 0

How to modify body css id tag in the head?

tony: Thanks, but no luck.

If I document.write "my_id" I do get "sectionone", but for some reason the linked stylesheet doesn't recognize it.

Here's the style if it helps...

body#sectionone #menu li#one a, {
	color: #096;
	text-decoration: underline;
	etc.
	}

TimeBandit
Offline
Enthusiast
Maryland, USA
Last seen: 18 years 4 weeks ago
Maryland, USA
Joined: 2004-09-02
Posts: 112
Points: 0

How to modify body css id tag in the head?

markw7 wrote:

body#sectionone #menu li#one a, {
	color: #096;
	text-decoration: underline;
	etc.
	}

could the comma after the "a" be causing an issue?

markw7
Offline
newbie
New Jersey
Last seen: 18 years 3 weeks ago
New Jersey
Joined: 2004-09-07
Posts: 4
Points: 0

How to modify body css id tag in the head?

TimeBandit wrote:

could the comma after the "a" be causing an issue?

hey timebandit -- I tried it and it didn't make any difference. (edit)

The problem isn't in the css code, because if I write the body tag like this...

<body id="sectionone">

...it works just fine. I think it has to do with the html side of it all. Thanks for the idea, though.

markw7
Offline
newbie
New Jersey
Last seen: 18 years 3 weeks ago
New Jersey
Joined: 2004-09-07
Posts: 4
Points: 0

How to modify body css id tag in the head?

Hey, I got it to work. Didn't know Dreamweaver allowed for something like this in a template...

<!-- TemplateParam name="id" type="text" value="sectionone" -->
</head>
<body id="@@(id)@@">
etc.

Cool beans.