Assuming that you put <script> tags around the JavaScript, and include
prototype in your page head, it does. One thing you may be overlooking is
source code order. If your script tag (containing this handler) occurs in the
page head, then the <input#login> will not exist yet at the time that the
handler goes looking for it (at the moment that the script is first read).
There are two ways around this.
1. (in the page head)
document.observe('dom:loaded', function(){
// your script here
});
2. (also in the page head)
document.on('click', '#login', function(evt, elm){
alert('t2')
});
Oh, and for completeness,
3. (somewhere after <input id="login"> appears in the source, like at the line
before </body>)
// your script, unmodified
Walter
On Jul 14, 2014, at 2:33 AM, Иван Иванов wrote:
> Hi Team,
>
> <input id="login" type='submit' value='login' />
>
> Event.observe("login", "click", function(){
> alert("t2");
> });
>
> Why don't work?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/prototype-scriptaculous.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/prototype-scriptaculous.
For more options, visit https://groups.google.com/d/optout.