Hi,
I have a web page describing a procedure using generic names. At the
top
of the page I have a text box. When the user enters a specific name in
the
text box, I would like the page to redisplay the procedure using the
name
entered in the box. For that I started like this:
<html>
<head>
<title>Docume nt Rewrite Example</title>
<script type="text/javascript">
function rewritePage() {
var newval = document.inform .namefield.valu e;
var txt;
if (newval.length == 0) {
txt = document.create TextNode("Gener ic");
} else {
txt = document.create TextNode(newval );
}
var elem = document.getEle mentById("name" );
elem.replaceChi ld(txt, elem.firstChild );
}
</script>
</head>
<body bgcolor="white" >
<form name="inform">
New Name : <input type="text" size="30" name="namefield "></input>
<input type="submit" value="Replace" onClick="rewrit ePage()"></input>
</form>
<h1> My name is <span id="name">Gener ic</span> </h1>
</body>
</html>
Problem is the name changes for a moment, but it changes back to the
original
value after the document is loaded completly.
How can I fix this.
--
...Senthil.
I have a web page describing a procedure using generic names. At the
top
of the page I have a text box. When the user enters a specific name in
the
text box, I would like the page to redisplay the procedure using the
name
entered in the box. For that I started like this:
<html>
<head>
<title>Docume nt Rewrite Example</title>
<script type="text/javascript">
function rewritePage() {
var newval = document.inform .namefield.valu e;
var txt;
if (newval.length == 0) {
txt = document.create TextNode("Gener ic");
} else {
txt = document.create TextNode(newval );
}
var elem = document.getEle mentById("name" );
elem.replaceChi ld(txt, elem.firstChild );
}
</script>
</head>
<body bgcolor="white" >
<form name="inform">
New Name : <input type="text" size="30" name="namefield "></input>
<input type="submit" value="Replace" onClick="rewrit ePage()"></input>
</form>
<h1> My name is <span id="name">Gener ic</span> </h1>
</body>
</html>
Problem is the name changes for a moment, but it changes back to the
original
value after the document is loaded completly.
How can I fix this.
--
...Senthil.
Comment