Assign behavior to class

K

Kirsten

Suppose I want to execute the same routine when "mouseover" is fired for
three diffent P elements:

<p name="p1" onmouseover="myRoutine(this)">....</p>
<p name="p2" onmouseover="myRoutine(this)">....</p>
<p name="p3" onmouseover="myRoutine(this)">....</p>


Is it possible to assign this behaviour using classes?
<p name="p1" class="myClass">....</p>
<p name="p2" class="myClass">....</p>
<p name="p3" class="myClass">....</p>

and then myClass.onmouseover = ......


Thanks!
 
K

Kevin Spencer

I ain't got no class either.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
M

Mike Mueller

No, classes refers to styling, not scripts


: Suppose I want to execute the same routine when
"mouseover" is fired for
: three diffent P elements:
:
: <p name="p1" onmouseover="myRoutine(this)">....</p>
: <p name="p2" onmouseover="myRoutine(this)">....</p>
: <p name="p3" onmouseover="myRoutine(this)">....</p>
:
:
: Is it possible to assign this behaviour using classes?
: <p name="p1" class="myClass">....</p>
: <p name="p2" class="myClass">....</p>
: <p name="p3" class="myClass">....</p>
:
: and then myClass.onmouseover = ......
:
:
: Thanks!
:
:
 
K

Kevin Spencer

I ain't got no style neither.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
S

Steve Easton

You can manipulate styles with a mouseover event, but you can't fire a script function with a style
"event."

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
S

Steve Easton

Example:

<td class="class1" onmouseover="this.className='class2'" onmouseout="this.className='class1'"
onmousedown="this.className='class3'">

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top