Hi, this is probably a trivial question but I'm so new to this I would learn a lot from any help... Why does the content in global variable "str" disappear as soon as I unclick the alertbox? How can I keep it? I put the string in a <div> and one see's the content disappear. here is the code :
<head>
<p>input your text </p>
<div>
<form method="get" id="testform" name="testform" onSubmit="document.str = subCont()">
<textarea name="locs" id="locs" cols="40" rows="5">
...
</textarea><br>
<INPUT TYPE=SUBMIT VALUE="Submit">
</form>
</div>
<div id="test"> </div>
</head>
<script type="text/javascript">
// I need the inputed text to stay in this variable
var str =new String();
function subCont(){
document.str=document.testform.locs.value;
document.getElementById("test").innerHTML= document.str;
alert(document.str);
return str;
}
</script>