dmgens wrote:
> Folks,
>
> When I try to get the array form form.getElements(); In FileFox or
> Netscape it works fine, but if I try the same code in IE 7 I get an
> "Object doesn't support this property or method"
>
> here is the code:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
> www.w3.org/TR/html4/loose.dtd">
> <html>
>
> <head>
> <meta http-equiv="content-type" content="text/html;
> charset=iso-8859-1">
> <meta name="author" content="David Gens">
>
> <title>Button Test</title>
> <script src="/bgeJS/prototype-1-6.js"></script>
> <script src="/bgeJS/AJAXhelper.js"></script>
> <script>
> function myshow(form) {
> alert("got here");
> tmp = form.getElements();
You could also use:
var tmp = document.forms[0].elements
Don't forget to declare variables, it's a bad idea to let them become
global for no good reason (especially loop counters like i below).
> out = '';
> for(i=0 ; i< tmp.length; i++){
> out += tmp[i].name+" "+tmp[i].type+"\r\n";
> }
> alert(out);
> myHead = document.getElementsByTagName('head');
> alert(myHead[0].innerHTML);
> }
> </script>
> </head>
>
> <body>
> <form>
> test: <input name="atest" type="text"></input>
That is invalid HTML: the end tag for input elements is forbidden.
<URL: http://www.w3.org/TR/html4/interact/forms.html#edef-INPUT >
> <br />
> <input type="button" name="submit" value="Submit Form"
It is a bad idea to name any form control "submit", it shadows the
form's submit method so you can't call it.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---