473,394 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

body onload problem

I am working with JSP and have a top and bottom jsp for each screen of
my application. I call javascript event that processess a form on one
of these screens.

This works fine on screen 1 but on screen two where the form is not
present the function is still called and i get and error message in the
browser saying that

'document.searchForm.moveFromDate' is not an object.

Is it possible to check that the form is present before the function
trys to do anything?

Any help would be much appreciated.

Thanks
Clive
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 20 '05 #1
2 4404


Clive Moore wrote:
I am working with JSP and have a top and bottom jsp for each screen of
my application. I call javascript event that processess a form on one
of these screens.

This works fine on screen 1 but on screen two where the form is not
present the function is still called and i get and error message in the
browser saying that

'document.searchForm.moveFromDate' is not an object.

Is it possible to check that the form is present before the function
trys to do anything?


Check
<body onload="if (document.forms.searchForm &&
document.forms.searchForm.elements.moveFromDate) {
// access
document.forms.searchForm.elements.moveFromDate here
}">

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
That work Martin

Thanks
Clive

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
2
by: Michal Pleban | last post by:
Hello! I noticed a very strange behavior an I cannot work it around. Id appreciate any help on this, as it's driving me nuts... I have a WinXP SP1 computer with MSIE 6. It has Flash plugin...
3
by: Greg | last post by:
Javascript Folks, I am relatively new to javascript and am working on a script where I want to utilizes a couple of iframes and format text in them. I have run into a problem with getting the...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
5
by: Patient Guy | last post by:
I have this in a document: <body onload="a_function(this);"> In an (external) script file, I define a_function() as follows: function a_function(obj) { // surprise errant coding here
6
by: tshad | last post by:
Is there a way during Page_Load to change or add an attribute to the Body tag? I want to be able to change the onLoad body attribute to do a focus on one of my text boxes, such as: ...
0
by: Andy Fish | last post by:
Hi, I managed to figure this one out for myself but thought I would post it here for the general good. I have an asp.net 1.1 application which was using smart navigation and also had a <body...
4
by: Jason | last post by:
Hi, Here's the scenario: I have a web application that has window A and window B. A user has both window A and B open - window A is in the foreground and window B is behind it. If the...
5
by: mazdotnet | last post by:
Hi, I have a master file with the following setting <body runat="server" id="Body"> and in the .cs I have Body.Attributes.Add("onload", "menuCurrentPage('current','navlist');"); Now in one...
2
by: WGW | last post by:
Hello all, I need another set of eyes cause it just isn't working, no matter how identical I make it. The initRotator function works when called by itself, but when adding another function, only the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.