tshad wrote:
[...]
No more that saving what is in the textboxes and which radio buttons that
were pushed. If you come back to the page, they are still there. Whatever
the SPAN originally was is also still there.
That's just how browsers work. Back in the good 'ol days, some
browsers didn't remember form values either but that was back with
Mozaic and Netscape 2 or somewhere back then.
I had a few comments on the code you've been posting, the only one of
use is in regard to your script tag: ditch the language attribute, it
is depreciated and will cause errors in some browsers.
You can do what you require if you have a form initialisation
function that looks at each form input and if there's something
there, runs the onchange if there is one.
Below is some sample code for what you are trying to do:
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'
'
http://www.w3.org/TR/html4/strict.dtd'>
<html><head>
<title>form thing</title>
<meta http-equiv='Content-Type'
content='text/html; charset=ISO-8859-1'>
<script type="text/javascript">
function writeToSpan(t,o) {
if (document.getElementById) {
o = document.getElementById(o);
} else if (document.all) {
o = document.all[o];
}
writeIt(t,o);
}
function writeIt(t,x) {
if ( x.firstChild && /\#text/i.test(x.firstChild.nodeName)) {
x.firstChild.data = t;
} else {
if (document.createTextNode) {
x.appendChild(document.createTextNode(t));
}
}
}
function initForm(f){
f = document.forms[f];
var i = f.length;
while (i--) {
if (/input/i.test(f
.nodeName)
&& /text/i.test(f.type)
&& f.onchange
&& '' != f.value){
f.onchange();
}
}
}
</script>
</head>
<body onload="initForm('formA');">
<form action="" name="formA">
<p>Write text to page:
<input name="inA" type="text" onchange="
writeToSpan(this.value,'outA');
"><span id="outA"></span>
<br>
Write text to input:
<input name="inB" type="text" onchange="
this.form.outB.value = this.value;
"><input type="text" name="outB">
<br><br>
<label for="inC">Replace this label:
<br><input name="inC" id="inC" type="text" onchange="
writeIt(this.value,this.parentNode);
"></label>
<br><br>
<input type="reset">
</p>
</form>
</body>
</html>