hi , The problem in using document.form[0]. and document.form[1] for first and second form respctively first form comes from Header.jsp and second form from myFoo.jsp and Header is there through out Application and the functionality that is part of Header that I need to write in myFoo.jsp there i need to pass same actionForm (This is where problem occured)..... And also i want myFoo.jsp as part of some Popup functionality where there is no Header.jsp included so in that case we have single form so document.form[1] will not work
please suggest Thanx Shakti On 02/08/06, Monkeyden <[EMAIL PROTECTED]> wrote:
Can we please stop suggesting use of the form name? It.will.not.work. If both forms have the same name, it makes a reference to document.forms ['foo'] an array and not a reference to the form. Of course you *could *do this: <html> <head> </head> <script language="JavaScript" type="text/javascript"> function tellMe(){ alert("Form 1: " + *document.forms['foo'][0].form2Text.value*); alert("Form 2: " + *document.forms['foo'][1].form2Text.value*); } </script> <body> <form action="foo" method="post" name="foo" id="foo"> <input type="text" name="form2Text" value="This is 1"> </form> <form action="bar" method="post" name="foo" id="bar"> <input type="text" name="form2Text" value="This is 2"> </form> <input type="button" name="myButton" value="Click It" onclick="tellMe();"> </body> </html> but A, that would be stupid, and B, you have to use the index value anyway. On 8/1/06, kalpesh modi <[EMAIL PROTECTED]> wrote: > > I am not sure whether > > document. form['formName'] will work or not. Give it a try. > > -Kalpesh > > > > --------------------------------- > Yahoo! Music Unlimited - Access over 1 million songs.Try it free. >