HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 15th, 2009, 07:03 AM
paulcm paulcm is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 84 paulcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 46 m 27 sec
Reputation Power: 5
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> 

Reply With Quote
  #2  
Old June 15th, 2009, 07:07 AM
micky's Avatar
micky micky is offline
Couch Potato Wizard
Click here for more information. Click here for more information
 
Join Date: Jan 2005
Location: India
Posts: 12,206 micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)  Folding Points: 1480 Folding Title: Novice Folder
Time spent in forums: 5 Months 2 Days 19 h 8 m 51 sec
Reputation Power: 2179
What if you try this?
Code:
var a = window.setTimeout("document.mfgawards.submit();",500);
__________________
Laziness is my religion and Sunday is my God

Get the Mantra!

Reply With Quote
  #3  
Old June 15th, 2009, 08:31 AM
paulcm paulcm is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 84 paulcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 46 m 27 sec
Reputation Power: 5
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

Reply With Quote
  #4  
Old June 15th, 2009, 09:34 AM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
ASP Free Expert (3500 - 3999 posts)
 
Join Date: Mar 2005
Location: I used to live at home, now I stay at the house
Posts: 3,514 ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 1 Month 1 Week 4 Days 7 h 1 m 31 sec
Reputation Power: 396
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!
Route of Queue | The General FAQ Thread | HOW TO POST A QUESTION

Perfectly Impossible - is the eagerly awaited debut release from Jayne Sarah - please buy it - it's really good!


Reply With Quote
  #5  
Old June 15th, 2009, 11:47 AM
paulcm paulcm is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 84 paulcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 46 m 27 sec
Reputation Power: 5
Thumbs up Thanks

Thankyou
That solved it
Best wishes
Paul M

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > JavaScript - Error help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
Stay green...Green IT