Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

name of the form

Status
Not open for further replies.

rastkocvetkovic

Programmer
Aug 11, 2002
63
SI
Well, this's been buging me for quite a while. The structure is like this.

<body>
<form name=&quot;something&quot;>
<SOME HTML THINGYS)
<script language=&quot;JavaScript&quot;>
DoSomething(this.formsname); //how to get this' forms name?
</script>
</form>
<SOME HTML THINGYS>
<A BUNCH OF DIFFERENTLY NAMED FORMS>
</body>

I hope you understand what I mean. I have many different forms, differently named. And inside of them I have a <javascript> island which need's to get the name of the form in which it is nesting.

Is that possible? Please help me.

Happy new year! :)


 
Maybe this will make you remember, how you've solved the problem above...

NEED HELP with a script. PLEASE!! :)

Regards, Rastko
 
Maybe this will be of use:
Code:
<script>
<!--
onload = formName;
function formName() {
	for (i=0; i<document.forms.length; i++) {
		alert(&quot;The name of form &quot;+i+&quot; is &quot;+document.forms[i].name);
	}
}
//-->
</script>

<form name=&quot;test&quot;>
</form>
<form name=&quot;hello&quot;>
</form>
<form name=&quot;form3&quot;>
</form>
 
well, this is useful only by one mean ... maybe i should insert one stupid-named field into the <form>bla bla</form> and test it in which form it is with such loop.
could this be the solution, or there's any other way to do it...

please help!
 
this should work, assuming you need the name of the first form on the page:

<script language=&quot;JavaScript&quot;>
DoSomething(document.forms[0].name);
</script>
=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top