If you invoke the "check_link " function using the "Go" link than
everything works as I expect.
If invoking it using the Submit button than the text field value shows
the new value ("Executed Link") for a split second and than reverts
back to the default value.
Why?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitl ed Document</title>
<script type="text/javascript" language="javas cript">
function check_link()
{ var new_link=docume nt.getElementBy Id('fName').val ue;
var newwin = window.open(new _link, "temp_win") ;
document.getEle mentById('fName ').value='Execu ted Link';
}
</script>
</head><body>
<form name="form1" method="post" action="">
<input name="fName" type="text" id="fName" value="http://google.net">
<a href="javascrip t:check_link()" >Go</a><br>
<input name="Submit" type="submit" onClick="check_ link();"
value="Submit">
</form>
</body>
</html>
everything works as I expect.
If invoking it using the Submit button than the text field value shows
the new value ("Executed Link") for a split second and than reverts
back to the default value.
Why?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitl ed Document</title>
<script type="text/javascript" language="javas cript">
function check_link()
{ var new_link=docume nt.getElementBy Id('fName').val ue;
var newwin = window.open(new _link, "temp_win") ;
document.getEle mentById('fName ').value='Execu ted Link';
}
</script>
</head><body>
<form name="form1" method="post" action="">
<input name="fName" type="text" id="fName" value="http://google.net">
<a href="javascrip t:check_link()" >Go</a><br>
<input name="Submit" type="submit" onClick="check_ link();"
value="Submit">
</form>
</body>
</html>
Comment