HighDots Forums  

Class style with event handler embedded ?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Class style with event handler embedded ? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pamelafluente@libero.it
 
Posts: n/a

Default Class style with event handler embedded ? - 08-24-2006 , 03:45 AM






Hi I am back with a question.

I have something like:

<span id ="SomeID1" onclick = "Clicked(this.id)"> <div class=c1>
Something here </div></span>
<span id ="SomeID2" onclick = "Clicked(this.id)"> <div class=c2>
Something here </div></span>
<span id ="SomeID3" onclick = "Clicked(this.id)"> <div class=c3>
Something here </div></span>

....thousands others ...


Q. Is it possible to define a class style for the <span> so that it
would include
onclick = "Clicked(this.id)" and so that I have not to repeat the
onclick it for each span?
If yes, what would the code be?

-Pam


PS
the javascript people have coded form me the div question, if anyone
interested


Reply With Quote
  #2  
Old   
Johannes Koch
 
Posts: n/a

Default Re: Class style with event handler embedded ? - 08-24-2006 , 04:12 AM






pamelafluente (AT) libero (DOT) it schrieb:
Quote:
I have something like:

span id ="SomeID1" onclick = "Clicked(this.id)"> <div class=c1
Something here </div></span
span id ="SomeID2" onclick = "Clicked(this.id)"> <div class=c2
Something here </div></span
span id ="SomeID3" onclick = "Clicked(this.id)"> <div class=c3
Something here </div></span

....thousands others ...

Q. Is it possible to define a class style for the <span> so that it
would include
onclick = "Clicked(this.id)" and so that I have not to repeat the
onclick it for each span?
No, CSS is about presentation, not behaviour. But you can add a listener
for click events by JavaScript. However this is off-topic in a
stylesheet group. Please ask in a JavaScript group.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


Reply With Quote
  #3  
Old   
pamelafluente@libero.it
 
Posts: n/a

Default Re: Class style with event handler embedded ? - 08-24-2006 , 05:13 AM



Thanks Johannes.

Ciao

-Pam

Johannes Koch ha scritto:

Quote:
pamelafluente (AT) libero (DOT) it schrieb:
I have something like:

span id ="SomeID1" onclick = "Clicked(this.id)"> <div class=c1
Something here </div></span
span id ="SomeID2" onclick = "Clicked(this.id)"> <div class=c2
Something here </div></span
span id ="SomeID3" onclick = "Clicked(this.id)"> <div class=c3
Something here </div></span

....thousands others ...

Q. Is it possible to define a class style for the <span> so that it
would include
onclick = "Clicked(this.id)" and so that I have not to repeat the
onclick it for each span?

No, CSS is about presentation, not behaviour. But you can add a listener
for click events by JavaScript. However this is off-topic in a
stylesheet group. Please ask in a JavaScript group.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.