Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Determine If Object Exist

Reply
Thread Tools

Determine If Object Exist

 
 
crjunk
Guest
Posts: n/a
 
      07-05-2005
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

 
Reply With Quote
 
 
 
 
BootNic
Guest
Posts: n/a
 
      07-05-2005
> "crjunk" <(E-Mail Removed)> wrote:
> news:(E-Mail Removed) oups.com....
>
> 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')}

--
BootNic Tuesday, July 05, 2005 5:57 PM

I try to take one day at a time, but sometimes several days attack me at once.
*Jennifer Unlimited*

 
Reply With Quote
 
 
 
 
crjunk
Guest
Posts: n/a
 
      07-06-2005
Thanks for your help. By adding the "if
(document.ScheduleForm.txtGr*ossPayroll99)" piece of code, my function
now works correctly.

CR Junk

 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      07-06-2005
JRS: In article <WnDye.764$(E-Mail Removed)>, dated
Tue, 5 Jul 2005 21:58:14, seen in news:comp.lang.javascript, BootNic
<(E-Mail Removed)> posted :
>
>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.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      07-06-2005
Dr John Stockton wrote:

> JRS: In article <WnDye.764$(E-Mail Removed)>, dated
> Tue, 5 Jul 2005 21:58:14, seen in news:comp.lang.javascript, BootNic
> <(E-Mail Removed)> posted :
>
>>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.


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?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      07-07-2005
JRS: In article <(E-Mail Removed)>, dated Wed, 6 Jul
2005 18:16:22, seen in news:comp.lang.javascript, Randy Webb
<(E-Mail Removed)> posted :
>Dr John Stockton wrote:


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

>
>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.


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

>
>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?

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      07-09-2005
Dr John Stockton wrote:

> JRS: In article <(E-Mail Removed)>, dated Wed, 6 Jul
> 2005 18:16:22, seen in news:comp.lang.javascript, Randy Webb
> <(E-Mail Removed)> posted :
>
>>Dr John Stockton wrote:

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

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

>
>
> 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.
>
>
>
>>>Presumably your offset is in the range -4 to -9 hours, since you give an
>>>FFF-compatible time.

>>
>>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 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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does my object exist? So why its HWND doesn't exist? That's a question... (CMonthCalCtrl control) LT C++ 7 07-25-2004 07:08 PM
nuby: determine method passed and determine the receiver that received the method Pea, Botp Ruby 1 01-24-2004 07:51 PM
Can the Favourites Sidebar (IE, Opera, etc.) be addressed selectively (exist or non-exist)? Markus Mohr Javascript 7 11-28-2003 12:20 AM
In Schema, how to say "If one element exist, another element must exist"? Y.S. XML 3 09-17-2003 02:51 PM
Help:Why can't I use namespace System.Web? It is said that this namespace doesn't exist. But it should exist. ASP .Net 1 07-29-2003 04:31 PM



Advertisments