|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
JavaScript - Error help
Hi the following script opens a new window and it works fine the window
opens except the page that created the new window suddenly has an error as though it has created the window but then finds an error afterwoods to clear the error I have tomessage I have to refresh the page I am using xhtml strict docktype the error is "document.form1 is null or not an object" but if I give the form a name="form1" I get the error "object doesn't support this property or method" Thankyou Paul M Here is the code ..................................... form header Code:
<form id="mfgawards" method="post" action="MFG_Awards_Entry_Details.asp" target="myNewWin" > submit button Code:
<input name="submit" type="submit" id="button" onClick="sendme();" value="Print entry cover page" /> .................................................. ......... Function(in the head) Code:
<script type="text/javascript">
//<![CDATA[
function sendme()
{
window.open("","myNewWin","width=600,height=600,toolbar=1,resizable=1,scrollb ars=1");
var a = window.setTimeout("document.form1.submit();",500);
}
//]]>
</script>
|
|
#2
|
||||
|
||||
|
What if you try this?
Code:
var a = window.setTimeout("document.mfgawards.submit();",500);
|
|
#3
|
|||
|
|||
|
Still there
Thanks For the reply Micky
I have tried both form1 and mfgawards as the id but it still happens. Do you think that the code is searching for a form name as apposed to id? If this is the case then I think the attribute name is not allowed in the strict docktype. There must be a way round it though. Thanks Paul M |
|
#4
|
||||
|
||||
|
The problem is that you have named your button "submit" - because
"submit" is a native method of "form", you've confused the compiler because it now doesn't know what you're trying to access when you call "form.submit". Change the name of the button to "btn_submit" and try again. ![]() Also, yes, you are calling the form wrong - your script is looking for a for in the page with name="form1". Change the setTimeout to this: Code:
window.setTimeout(document.mfgawards.submit, 500);
__________________
Support requests via PM will be ignored! |
|
#5
|
|||
|
|||
|
Thankyou
That solved it Best wishes Paul M |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > JavaScript - Error help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|