I have a web page,with a text input which a user will enter some text. There is a hidden input element on the page that stores the values submitted,so as a user keeps entering values , they will be appended to the hidden input element, I then use the value stored here to output all values entered to the user, see the code below
<SCRIPT TYPE="text/javascript">
function get_val(val)
{
var name = val.input1.value;
if(document.getElementById("input2").value != "")
{
var new_name = document.getElementById("input2").value;
name = new_name.concat(" AND " +document.getElementById("input1").value);
document.getElementById("input2").value = name
alert(name);
history.go(0); //this will be explained below
}
if(document.getElementById("input2").value == "")
{
document.getElementById("input2").value = name;
}
}
</SCRIPT>
<h3>Enter word</h3>
<form id="frm1" name="frm1">
<input id="input1" name="input1" type="text" size="40" value="" />
<input id="input2" name="input2" type="hidden" size="40" value=""/>
<input id="button" name="button" type="button" value="get name" OnClick="get_val(this.form)"/>
</form>
Now note the history.go(0); line, I've put this in to demonstrate my problem. it works fine in most browsers, except sometimes in IE version 7.0.5730.1.3, when the page is reloaded, the hidden input element is cleared, causing undesirable results.
Does anyone know any reason why this occurs occasionally with Internet explorer7
Thanks in Advance Ruth