getElementById is indeed the "standards-compliant" method... but something
which came in a bit late!!! Browser IE 5+ and Netscape 6+ support them...
but the earlier version browsers does not support getElementById (since
these browsers date before the standard was introduced.
Also the standard practice followed for manipulating forms in the HTML
document using JavaScript is the form array/object rather than
getElementById. (Doesn't mean that you cannot/should not use getElementById)
getElementById is introduced keeping in mind the DHTML parts and as a
standard way to access the DOM elements which were not exposed as
arrays/object for JavaScript. For e.g.. accessing the table cells/rows or
DIV/SPAN elements etc to bring in DHTML effects.
HTH,
Nitesh Naveen
----- Original Message -----
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Monday, June 27, 2005 10:39 AM
Subject: RE: javascript html:fprm and getElementById
Remember that getElementById is the "standards-compliant" method, the
others are not, IIRC. They of course work too, but when manipulating DOM
objects, getElementById is supposed to be used, according to the current
standards.
Is there such a thing as casting in JS? I'm not sure. I don't think
there is as far as object references go anyway, but I could be wrong.
Frank
-----Original Message-----
From: "Nitish Kumar"<[EMAIL PROTECTED]>
Sent: 6/27/05 12:37:42 AM
To: "'Struts Users Mailing List'"<user@struts.apache.org>
Subject: RE: javascript html:fprm and getElementById
I geuss, some thing working or not working in JavaScript is a lot
dependent
on what version of what browser, are you using.
Well, Any ways, from my previous experience with JavaScript, usually
document.getElementById gives you an object, and casting it to form
doesnt
work all the time..
it is always better to use document.forms[i].action .
Thanks and Regards,
Nitish Kumar
-----Original Message-----
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 3:05 AM
To: Struts Users Mailing List
Subject: Re: javascript html:fprm and getElementById
Why do you believe this does not work? I just tried in IE and it
worked
fine, as I would expect since I do this sort of thing all the time.
I would suggest throwing an alert before and after the code setting the
action, display what the action of the form is. I did this and it does
indeed change.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
Arash Bijanzadeh wrote:
> Hi,
> I need to change the action of my form on the fly. I use the
following
> javascript:
> function setParam(mode)
> {
> document.getElementById("myform").action ="<%=(String)
> request.getAttribute("origin")%>"
> + mode+ ".do";
> document.forms[0].submit();
>
> }
> and my form is :
> <html:form action="<%=(String) request.getAttribute("origin")%>"
> styleId="myform" >
>
> It works perfect under mozilla but not IE. I think the problem is
that IE
> looks for Id in the name field of form and he couln't find it.
> Could anyone help me?
> Regards
> ARash
>
[Message truncated. Tap Edit->Mark for Download to get remaining portion.]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]