RE: JavaScript 'this' question

2000-10-26 Thread Hays, Duncan

Thanks. I think I'm catching on. I'm trying to simplify a long js and this
will go a long way towards that. Part of my problem has been that I've
written extra code (blocks for each row of my form) so that less code will
have to execute when it's called because IE5 on our NT boxes is running js
very slowly. For example, code that used to take 7500 milliseconds is now
down to 2700 milliseconds. Of course the same code only takes 10-20 in
Netscape 4.7 and only 60 on a Mac running IE5 and 10-20 in IE5 on Win98.

Speed aside, I still want to clean the code.

Duncan Hays
Peace Corps

-Original Message-
From: Courtney Payne [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 25, 2000 9:42 AM
To: CF-Talk
Subject: RE: JavaScript 'this' question


Duncan,

Kill the document.formName.  Instead of...

document.formName.obj.value

Just use...

obj.value

Courtney E. Payne, Developer
Fig Leaf Software
"We've got you covered"
[EMAIL PROTECTED]
www.figleaf.com 


-Original Message-
From: Hays, Duncan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 25, 2000 9:34 AM
To: CF-Talk
Subject: JavaScript 'this' question


I want to be able pass a validated value back to a form without explicitly
assigning the value in JS and I can't figure it out or even whether it can
be done. Something like:



Then in js have:

function validate(obj){
if (document.formName.obj.value == "field1"){
document.formName.ojb.value = 1;
}
else{
document.formName.obj.value = 2;
}
}


When I do this I get errors saying that "document.formName.obj has no
properties".

Thanks
Duncan Hays
Peace Corps


Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]


Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]



RE: JavaScript 'this' question

2000-10-25 Thread Courtney Payne

Duncan,

Kill the document.formName.  Instead of...

document.formName.obj.value

Just use...

obj.value

Courtney E. Payne, Developer
Fig Leaf Software
"We've got you covered"
[EMAIL PROTECTED]
www.figleaf.com 


-Original Message-
From: Hays, Duncan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 25, 2000 9:34 AM
To: CF-Talk
Subject: JavaScript 'this' question


I want to be able pass a validated value back to a form without explicitly
assigning the value in JS and I can't figure it out or even whether it can
be done. Something like:



Then in js have:

function validate(obj){
if (document.formName.obj.value == "field1"){
document.formName.ojb.value = 1;
}
else{
document.formName.obj.value = 2;
}
}


When I do this I get errors saying that "document.formName.obj has no
properties".

Thanks
Duncan Hays
Peace Corps


Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]