This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > August 2006 > Class style with event handler embedded ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Class style with event handler embedded ?
pamelafluente@libero.it

2006-08-24, 6:50 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

Johannes Koch

2006-08-24, 6:50 am

pamelafluente@libero.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.)
pamelafluente@libero.it

2006-08-24, 6:50 am

Thanks Johannes.

Ciao

-Pam

Johannes Koch ha scritto:

> pamelafluente@libero.it schrieb:
>
> 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.)


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews