Determine If Object Exist

C

crjunk

I have a script that will set the focus to a particular input box. I
want the script to check to see if the input box exist also.

I'm receiving the following error:
'document.ScheduleForm.txtGrossPayroll99' is null or not an object.

The txtGrossPayroll99 is a field that does not exist. I've hard-coded
this name into the script to see if it is working correctly.
I'm using the OnLoad event inside the <Body> tag to execute this
function.


var formInUse = false;
function setFocus()
{
if ((!formInUse) && (typeof(document.ScheduleForm.txtGrossPayroll99) !=
"undefined") && (typeof(document.ScheduleForm.txtGrossPayroll99) !=
null) );{
document.ScheduleForm.txtGrossPayroll99.focus();
}
}

Can someone tell me what I'm doing wrong?

Thanks,
CR Junk
 
B

BootNic

crjunk said:
I have a script that will set the focus to a particular input box. I
want the script to check to see if the input box exist also.

I'm receiving the following error:
'document.ScheduleForm.txtGrossPayroll99' is null or not an object.

The txtGrossPayroll99 is a field that does not exist. I've hard-coded
this name into the script to see if it is working correctly.
I'm using the OnLoad event inside the <Body> tag to execute this
function.


var formInUse = false;
function setFocus()
{
if ((!formInUse) && (typeof(document.ScheduleForm.txtGrossPayroll99)
!= "undefined") && (typeof(document.ScheduleForm.txtGrossPayroll99) !=
null) );{
document.ScheduleForm.txtGrossPayroll99.focus();
}
}

Can someone tell me what I'm doing wrong?

Thanks,
CR Junk

/*If ScheduleForm true check for txtGrossPayroll99*/
if(document.ScheduleForm){
/*If txtGrossPayroll99 true alert yup*/
if(document.ScheduleForm.txtGrossPayroll99){alert('yup')}
/*Esle if txtGrossPayroll99 false alert nope*/
else if(!document.ScheduleForm.txtGrossPayroll99){alert('nope')}
}
/*If SCheduleForm false alert No form to check*/
else if(!document.ScheduleForm){alert('No form to check')}
 
C

crjunk

Thanks for your help. By adding the "if
(document.ScheduleForm.txtGr­ossPayroll99)" piece of code, my function
now works correctly.

CR Junk
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Tue, 5 Jul 2005 21:58:14, seen in BootNic
BootNic Tuesday, July 05, 2005 5:57 PM

In an international medium, giving the time to the minute is rather
pointless unless you also give the offset from GMT/UTC. Don't use a TLA
for that; BST has at least three meanings.

Presumably your offset is in the range -4 to -9 hours, since you give an
FFF-compatible time.
 
R

Randy Webb

Dr said:
JRS: In article <[email protected]>, dated
Tue, 5 Jul 2005 21:58:14, seen in BootNic



In an international medium, giving the time to the minute is rather
pointless unless you also give the offset from GMT/UTC.

Even then it is pointless, except to people who like to be pedantic
about the minutes.

Don't use a TLA for that; BST has at least three meanings.

EST probably has more than that......
Presumably your offset is in the range -4 to -9 hours, since you give an
FFF-compatible time.

Making assumptions again?
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Wed, 6 Jul
2005 18:16:22, seen in Randy Webb
Dr John Stockton wrote:

EST probably has more than that......

Chronologically, only Eastern Standard Time, as far as I know - in
America and in Australia. Anyone know, for certain, of any others? It
also has a meaning in Latin and French, at least.

Making assumptions again?

When the context implies nothing about time-of-day, few other than
Americans would use the 12-hour clock to state the time-of-day in an
international technical communication medium. The hypothesis is
supported by his use of prodigy.net, an organisation unwise enough to
put NNTP-Posting-Date: Tue, 05 Jul 2005 17:58:14 ETD in his header.

Americans find it hard to understand exactly how silly and parochial the
rest of the world finds them to be. How much foreign travel (not
counting in Canada, if any) did your present President do in the Second
Millennium?
 
R

Randy Webb

Dr said:
JRS: In article <[email protected]>, dated Wed, 6 Jul
2005 18:16:22, seen in Randy Webb



Chronologically, only Eastern Standard Time, as far as I know - in
America and in Australia.

Just because you don't know doesn't mean they don't exist, hence my use
of the word "probably", but it's irrelevant.
Anyone know, for certain, of any others? It
also has a meaning in Latin and French, at least.





When the context implies nothing about time-of-day, few other than
Americans would use the 12-hour clock to state the time-of-day in an
international technical communication medium.

The context I read what you replied to, which was a signature, was
indeed a time of day, but you chose to read it the way you wanted to
read it. That's your choice but it doesn't make you right.

The hypothesis is supported by his use of prodigy.net, an organisation
unwise enough to put NNTP-Posting-Date: Tue, 05 Jul 2005 17:58:14 ETD
in his header.

The problem with the support of your hypothesis is an incorrect
assumption. I am sure you can find the incorrect assumption.
Americans find it hard to understand exactly how silly and parochial the
rest of the world finds them to be.

And the rest of the world finds it hard to understand why most Americans
don't care what the rest of the world thinks.

How much foreign travel (not counting in Canada, if any) did your present
President do in the Second Millennium?

What this has to do with the date/time stamp in a signature totally
eludes me, but, I will answer you anyway even though I know it's nothing
more than an attempt by you to display your blatantly anti-US attitude.

An exact answer, I do not know and I do not care. An educated guess?
Probably more times than the Queen Mother depended on the US to save her
crown in the last 100 years.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top