Helpful sort?? Hmmm, not sure whether that is good or not.... ;)
Anyway, below you'll find an example that builds an array of textareas on the page and then loops through it alerting each value of the area. Notice that it isn't very cross browser as it uses getElementById and getElementsByTagName.....
Cheers,
Imar
Code:
<html>
<head>
<title>Array of Text Areas</title>
<script language="JavaScript">
function OnLoad()
{
var allTextAreas;
// get a reference to all <textarea> tags in the page
if (document.all || document.getElementsByTagName)
{
allTextAreas = document.getElementsByTagName("textarea");
}
else
{
document.write("Unrecognized Browser Detected");
}
// If there are textareas
if (allTextAreas.length > 0)
{
for (i = 0; i < allTextAreas.length; i++)
{
alert(document.getElementById(allTextAreas[i].id).value);
}
}
}
</script>
</head>
<body onload="OnLoad();">
<textarea id="txt1">Text 1</textarea>
<textarea id="txt2">Text 2</textarea>
<textarea id="txt3">Text 3</textarea>
</body>
</html>
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.