jaydee
10-13-2002, 01:32 AM
Hello!
Any help here would be greatly appreciated!
I have a situation where I will have multiple occurences of the same form in a HTML document. (ie multiple forms on a page where the forms all have the same name and its elements have the same names as those on the other forms.)
When the user hits a button on one of the forms, a Javascript function is called to open another window and display the selected form elements in this window.
How do I use arrays to handle this?
I've included a cut down version of the type of form processing that I wish to use. This code will work for one instance of the form.
I'm confused about how I define an array for forms and access the elements in that array.
The code......
<html>
<head>
<script language="JavaScript">
<!--
function print()
{
msgBox=window.open("","displayWindow",menubar="yes",
scrollbars="yes",status="yes",width=200,height=200);
msgBox.document.write(document.demo.author.value)
msgBox.document.write(document.demo.title.value)
}
//-->
</script>
</head>
<body>
<form name="demo">
<input type="hidden" name="author" value="Smith J. Jones G.">
<input type="text" name="title" value="How Green is my Valley">
<input type="button" value="Details" onClick='print()'>
</form>
Any help here would be greatly appreciated!
I have a situation where I will have multiple occurences of the same form in a HTML document. (ie multiple forms on a page where the forms all have the same name and its elements have the same names as those on the other forms.)
When the user hits a button on one of the forms, a Javascript function is called to open another window and display the selected form elements in this window.
How do I use arrays to handle this?
I've included a cut down version of the type of form processing that I wish to use. This code will work for one instance of the form.
I'm confused about how I define an array for forms and access the elements in that array.
The code......
<html>
<head>
<script language="JavaScript">
<!--
function print()
{
msgBox=window.open("","displayWindow",menubar="yes",
scrollbars="yes",status="yes",width=200,height=200);
msgBox.document.write(document.demo.author.value)
msgBox.document.write(document.demo.title.value)
}
//-->
</script>
</head>
<body>
<form name="demo">
<input type="hidden" name="author" value="Smith J. Jones G.">
<input type="text" name="title" value="How Green is my Valley">
<input type="button" value="Details" onClick='print()'>
</form>