Page 1 of 1
Javascript and Mozilla
Posted: Sun Jun 26, 2005 3:10 am
by s.dot
This doesn't seem to work in mozilla firefox, but it does in IE.
All it's supposed to do is call a function called resetForm() on the main page which clears a form field and gives it focus. (the page this code is contained on is within an IFRAME)
Code: Select all
<script type="e;text/javascript"e;><!--
if(parent.resetForm)
parent.resetForm();
//-->
</script>
I even tried just a simple
Code: Select all
<script type="e;text/javascript"e;><!--
parent.resetForm();
//-->
</script>
How do I call the function resetForm(); in mozilla?
Posted: Sun Jun 26, 2005 5:16 am
by s.dot
okay, so the problem may not lie in parent.resetForm(); but in the actual function itself.
Does Mozilla support document.getElementById("id").value=""; ?
I'm guessing it's an IE DOM feature that mozilla's decided against using.
How else would I do this javascript in Mozilla?
Code: Select all
function resetForm(){
document.getElementById("e;message"e;).value = "e;"e;;
document.getElementById("e;message"e;).focus();
}
Posted: Sun Jun 26, 2005 6:35 am
by Chris Corbyn
scrotaye wrote:Does Mozilla support document.getElementById("id").value=""; ?
It's a standard DOM feature which is (or at least should be) supported by all browsers.
Do you just want to reset the value of a form? Is this on a button press or something?
The function itself is done correctly... but not sure exactly the scenario you're calling it in.
Posted: Sun Jun 26, 2005 8:54 am
by phpScott
you might want to try parent.document.resetForm();
Posted: Sun Jun 26, 2005 8:57 am
by Chris Corbyn
phpScott wrote:you might want to try parent.document.resetForm();
OMG... did I just do that?

Posted: Sun Jun 26, 2005 9:00 am
by phpScott
wha , huh?
Posted: Sun Jun 26, 2005 12:03 pm
by s.dot
d11wtq wrote:
The function itself is done correctly... but not sure exactly the scenario you're calling it in.
Alright, there's the main page, which contains a text entry field. This page also contains the resetForm(); function.
Code: Select all
function resetForm(){
document.getElementById("e;message"e;).value = "e;"e;;
document.getElementById("e;message"e;).focus();
}
Then, upon submission of this form, it is passed to a frame, which then clears the form on the main page, and processes the input.
The code on this page is
Code: Select all
<script type="e;text/javascript"e;><!--
if(parent.resetForm)
parent.resetForm();
//-->
</script>
And parent.document.resetForm(); does not appear to work
