Nathan,
I am not getting this yet!
Say I have following simple form - what is
getData(evt.element().myform);
sending to getData()?
Cheers,
Geoff
<form name="myform1" action="#">
<input type="text" name="info">
<input type="button" name="send" id="send" value="enter">
</form>
<script>
document.observe("dom:loaded", function () {
if ($("send")) {
$("send").observe("click", function (evt) {
evt.stop();
getData(evt.element().myform);
});
}
});
</script>
On Jan 15, 2:29 pm, nlloyds <[email protected]> wrote:
> Geoff,
>
> > 'afraid I'm not able to follow all you've written but could you just
> > explain what you mean by "avoiding inline event handlers"?
>
> > <input type="button" name="send" disabled="disabled" value="Send"
> > onClick="getData(this.form)">
>
> > Would above have to be changed/replaced?
>
> An inline event handler means you're putting scripts in html elements
> instead of separating them out, which is almost always preferred. So,
> you can keep the html as (with an added id attribute):
>
> <input type="button" name="send" id="send" disabled="disabled"
> value="Send"
> />
>
> and add a script tag to the bottom of you're page:
>
> document.observe("dom:loaded", function () {
> if ($("send")) {
> $("send").observe("click", function (evt) {
> evt.stop();
> getData(evt.element().form);
> });
> }
>
> });
>
> Or something like that. So observe the DOM loaded event, and then
> observe clicks on the element.
>
> Thanks,
>
> Nathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---