javascript to reset html-page does not work after postback
-
Hello! I got a button with this code to reset the page:
javascript:document.aspnetForm.reset();return false;
it works like a charm. Except when the page is reloaded the javascript suddenly doesnt work anymore. Nothing at all happens when I click the button. Does anyone have an idea why this might be?
-
Hello! I got a button with this code to reset the page:
javascript:document.aspnetForm.reset();return false;
it works like a charm. Except when the page is reloaded the javascript suddenly doesnt work anymore. Nothing at all happens when I click the button. Does anyone have an idea why this might be?
I am just speculating here, but maybe the browser thinks there is nothing to reset if the page has just been loaded? Maybe it keeps of track of whether anything has actually been modified in the form before deciding whether to do anything about a "reset" call.
-- gleat http://blogorama.nerdworks.in[^] --
Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
-
I am just speculating here, but maybe the browser thinks there is nothing to reset if the page has just been loaded? Maybe it keeps of track of whether anything has actually been modified in the form before deciding whether to do anything about a "reset" call.
-- gleat http://blogorama.nerdworks.in[^] --
Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
Thanks for your reply! You´re absolutely right, if I type something after the reload, the new text will be deleted when I click the button, but the old text remains! I wonder how one should solve this, I wouldn´t want to do a postback just to emtpy a few textboxes.
-
Hello! I got a button with this code to reset the page:
javascript:document.aspnetForm.reset();return false;
it works like a charm. Except when the page is reloaded the javascript suddenly doesnt work anymore. Nothing at all happens when I click the button. Does anyone have an idea why this might be?
I don't know why but I tried this way and it's worked :
<script type="text/javascript">
function resetForm()
{
var tag = document.getElementById("form1").reset();
return false;
}
</script><input type="button" name="button" id="button" value="Button" onclick="resetForm();"/> -
I don't know why but I tried this way and it's worked :
<script type="text/javascript">
function resetForm()
{
var tag = document.getElementById("form1").reset();
return false;
}
</script><input type="button" name="button" id="button" value="Button" onclick="resetForm();"/> -
Hello! I got a button with this code to reset the page:
javascript:document.aspnetForm.reset();return false;
it works like a charm. Except when the page is reloaded the javascript suddenly doesnt work anymore. Nothing at all happens when I click the button. Does anyone have an idea why this might be?