<html>
<head>
<title>Input form</title>
<script type="text/javascript">
window.onload=setupEvents;
function setupEvents() {
document.someForm.onsubmit=validateForm;
}
function validateForm() {
var strResults = "";
for (var i = 0; i < document.someForm.elements.length - 1; i++) {
strResults += document.someForm.elements[i].value;
}
document.someForm.elements[3].value = strResults;
document.someForm.text4.value = document.someForm.elements[3].value+"**";
return false;
}
</script>
</head>
<body>
<form name="someForm">
<input type="text" name="text1" /><br />
<input type="password" name="text2" /><br />
<input type="hidden" name="text3" value="hidden value" />
<textarea name="text4" cols=50 rows=10>The text area</textarea>
<input type="submit" value="Submit" />
</form>
</body>
</html>
|