Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Attaching events
Message
De
20/07/2001 15:30:38
 
 
À
20/07/2001 14:58:52
Information générale
Forum:
Internet
Catégorie:
DHTML
Divers
Thread ID:
00533310
Message ID:
00533326
Vues:
9
Found it. For those interested:
In IE5+ only, with the < script > tag, you can attach code to an event for a particular object.
If I attach the onkeypress event of the body element this way, and route based on the event.srcElement.className, it works.

e.g.
< style >
  .dateCls {}
< /style >
< script for="bodyTag" event="onkeypress" language="javascript">
  if(event.srcElement.className=="dateCls")
    dateKeyPress(event.srcElement);
< /script>
>I know that using javascript, you can do the following to attach an event to a particular method:
>
>
frm.myButton.onclick = myOnClick();
>
>Does anyone know if there's a way to attach an event to a < style > defined class? Or a similar technique?
>
>I've got some date controls that call a calendar or using Quicken(r) style entry (T,+,-, etc). There's usually more than one per page. I'd like to be able to do this without naming each control specifically or passing control reference/name to another function.
>
>e.g. instead of
frm.dStart.onkeypress = dateKeyPress();
>frm.dEnd.onkeypress = dateKeyPress();
>something like a style definition
< style > dateCls {onkeypress:dateKeyPress()}
>< /style >
>...
>< input class="dateCls">...
>TIA.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform