M
Mad Scientist Jr
I'm trying to set the inner html of a div tag (browser is IE6) - it
seems to work, but as soon as the function ends, the changes disappear.
How do you make the changes stick? Thanks
PS here is the code
<html>
<head>
<title>inner html test</title>
<script language="javascript">
<!-- begin script
function UpdateDiv ()
{
div1.innerHTML = '<h1>' + document.TestForm.txtInput.value + '</h1>';
div1.visibility = "show";
//document.getElementById('div1').innerHTML='<h1>' +
document.TestForm.txtInput.value + '</h1>';
alert("in IE6 after you click OK, the inner html disappears...");
}
// end script -->
</script>
</head>
<body>
<FORM METHOD="post" ACTION="" NAME="TestForm" ID="TestForm" >
type something: <input type="text" name="txtInput" id="txtInput"
value="hello" size="5"><br>
<input type="submit" value="click to display below in div tag"
onClick="UpdateDiv();"><br>
<div id="div1" name="div1"></div>
</FORM>
</body>
</html>
seems to work, but as soon as the function ends, the changes disappear.
How do you make the changes stick? Thanks
PS here is the code
<html>
<head>
<title>inner html test</title>
<script language="javascript">
<!-- begin script
function UpdateDiv ()
{
div1.innerHTML = '<h1>' + document.TestForm.txtInput.value + '</h1>';
div1.visibility = "show";
//document.getElementById('div1').innerHTML='<h1>' +
document.TestForm.txtInput.value + '</h1>';
alert("in IE6 after you click OK, the inner html disappears...");
}
// end script -->
</script>
</head>
<body>
<FORM METHOD="post" ACTION="" NAME="TestForm" ID="TestForm" >
type something: <input type="text" name="txtInput" id="txtInput"
value="hello" size="5"><br>
<input type="submit" value="click to display below in div tag"
onClick="UpdateDiv();"><br>
<div id="div1" name="div1"></div>
</FORM>
</body>
</html>