Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kick off JavaScript with CSS?

Status
Not open for further replies.

Kindon

Programmer
Apr 19, 2001
54
US
Changing CSS with JavaScript is pretty well known. Is there a way to go the other way? Take the following code for example:

<body onload=&quot;runOnLoad()&quot;>

Can you set a listener in CSS to catch the onload event and then kick off the JavaScript script?

The following code does not work, of course. But maybe you can get an idea of what I am trying to do:

body:eek:nload {javascript:runOnLoad()}

or

body {onload:javascript.runOnLoad()}

=================================================
 
Hehe. I knew there had to be a way. Works like a charm. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top