RE: Netscape 4 not rendering Textboxes

by "Campbell, Rebecca" <Rebecca.Campbell(at)converg.com>

 Date:  Mon, 5 Jun 2000 09:57:07 -0600
 To:  "'Francois de Beer'" <fbeer(at)sars.gov.za>,
"''hwg-techniques(at)mail.hwg.org ' '" <hwg-techniques(at)mail.hwg.org>
  todo: View Thread, Original
seems like you could loop through the form elements and do the same check,
no?

this code worked for me to alert the values of the two form elements (i
didn't check for a type of input, though)...

<html>
<head>
	<script language="javascript">
	function getElements() {
	  for(j=0;j<document.forms[0].elements.length;++j) {
	    alert(document.forms[0].elements[j].value);
	  }
	}  
	</script>
</head>

<body>
<form name="myForm">
<input type="text" name="lsdjf" value="one">
<input type="submit" value="two" onClick="getElements()">
</form>

</body>
</html>

hth,
rebecca
http://www.nerdygirl.com

-----Original Message-----
From: Francois de Beer [mailto:fbeer(at)sars.gov.za]
Sent: Sunday, June 04, 2000 11:59 PM
To: ''hwg-techniques(at)mail.hwg.org ' '
Subject: RE: Netscape 4 not rendering Textboxes


Lets get back to the issue I had with the boxes...
The point is/was that if I put the textbox in a form, I can't reference it
with script coz I get its name/id/value by using:

<HTML id="theHTML">
Then I use a loop to run trough all the INPUT Tags and get their names/id's
with:

if (theHTML.all[i].tagName == 'INPUT')
	{
		//alert(theHTML.all[i].id); // to check the ID
		var varVal = theHTML.all[i].value;
	}

If these <INPUT>'s were in a form, the script would have to be:

	var varVal = formName.theHTML.all[i].value;

which doesn't work of course

So. Instead of arguing about what is correct and what is not, the issue
remains.
Is there a way to get the values out of <INPUT>'s on a page/in a form if
there is 20+ <INPUT>'s and you don't know their names, other than the way I
did it?

If there is no other way, then it sometimes will HAVE TO BE possible to use
<INPUT>'s outside a <FORM></FORM> ???

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.