navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Using CSS and Javascript together

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Using CSS and Javascript together
Page: [1]
 
leanneB14

 

Posts: 36
Joined: 2/19/2004
Status: offline

 
Using CSS and Javascript together - 2/19/2004 22:39:17   
Hi I have a slight problem,

My site uses a javascript drop down menu. I have recently changed to using frames and now this drop down menu has its top level in one frame and then the drop downs appear in the frame below. The problem is, i need to put some javascript in the body tag of every page going to be in the frame that has the drop downs on it.
I have many pages and don't want to have to manually go through and implement this. Another reason is that other people at work will be creating their own subwebs but usign my global navigation, so i don't want to rely on them to add the code. Is the any way i can put this in the stylesheet. Currently this is what i have but it doesn't work

body {onload: javascript:{if(parent.frames[0]&&parent.frames['contents'].Go)parent.frames['contents'].Go()}; margin: 0px; padding: 0px;}

this is what i'd put in the html file
<body onload="javascript:{if(parent.frames[0]&&parent.frames['contents'].Go)parent.frames['contents'].Go()}">

Can anyone help?
Giomanach

 

Posts: 6115
Joined: 11/19/2003
From: England
Status: offline

 
RE: Using CSS and Javascript together - 2/20/2004 3:39:34   
quote:

body {onload: javascript:{if(parent.frames[0]&&parent.frames['contents'].Go)parent.frames['contents'].Go()}; margin: 0px; padding: 0px;}


As far as I know, that is far from valid CSS. I'm not even sure onload is a CSS command. Unless I'm wrong, of which I seem to be good at recently, JavaScript can't be implemented into a CSS style sheet. Unfortunatley, I believe that JavaScript is all done through the HTML document, rather than trying to be clever and putting it into the CSS style sheet.

HTH

Dan

_____________________________




(in reply to leanneB14)
jaybee

 

Posts: 14176
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Using CSS and Javascript together - 2/20/2004 4:50:43   
quote:

ORIGINAL: Giomanach

Unless I'm wrong, of which I seem to be good at recently, JavaScript can't be implemented into a CSS style sheet.


No I don't think you're wrong. I haven't found any way to do it. I stick it in a div.

<div class="text1">script call goes here</div>

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Giomanach)
leanneB14

 

Posts: 36
Joined: 2/19/2004
Status: offline

 
RE: Using CSS and Javascript together - 2/22/2004 17:21:29   
Thanks anyway. It looks like i'm going to have to either implement the onload in every page, or just forget about the frames version of my intranet. Or maybe use a CSS drop down menu.

(in reply to jaybee)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Using CSS and Javascript together
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts