473,324 Members | 2,196 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,324 software developers and data experts.

if (mandatory<=21) { mandtory++; } gives me an error Object expected in some cases:

I have this function, which should change a value of the texfield(s)
depending on the radio buttons selection.
function foo(obj) {
if (!array[obj.name]) { flag++; }

if (array[obj.name] != obj.value ) {
array[obj.name]=obj.value;

if (array[obj.name]=='no' && ( array1[obj.name]=='yes' ||
!array1[obj.name] ) ) {
if (mandatory<=21) { mandtory++; }
document.form1.ManProNuErr.value=parseInt(window.d ocument.form1.ManProNuErr.value)
+ 1;
array1[obj.name]=obj.value;
array2[obj.name]='';
alert ("no");
}
if (array[obj.name]=='na' && (array1[obj.value]=='' ||
array1[obj.value]=='yes') ) { mandatory-- ;}

if ((array[obj.name]=='yes' && array1[obj.name]=='no' ) ||
(array[obj.name]=='na' && array1[obj.name]=='no') ) {

if (array[obj.name]=='na') {
mandatory--;
alert ("na");

array2[obj.name]='na';
array1[obj.name]='yes';
document.form1.ManProNuErr.value=parseInt(window.d ocument.form1.ManProNuErr.value)
- 1;
}
else if (array[obj.name]=='yes') {
<b> if (mandatory<=21) { mandtory++; } </b>
document.form1.ManProNuErr.value=parseInt(window.d ocument.form1.ManProNuErr.value)
- 1;
array1[obj.name]=obj.value;
array2[obj.name]='';
alert("yes");

}

}

}

}

document.form1.ManProPrsErr.value=roundit((mandato ry-parseInt(document.form1.ManProNuErr.value))/mandatory*100,
2) + '%';
}

So the function works greate if i remove the lines "if (mandatory<=21)
{ mandtory++; } " there are two of them, one is when no is pressed and
another one is when yes is pressed.
And the error i recive is kinda clueless object expected, pointing to
the html line: " <td class="style17"><span class="style9"></span></td>"
But to calcuate the percentage, i need those lines to be able to know
how many 'na's were pressed.

Any1 have any idea??

Nov 8 '06 #1
6 1340
Ruso wrote on 08 nov 2006 in comp.lang.javascript:
So the function works greate if i remove the lines "if (mandatory<=21)
{ mandtory++; } " there are two of them, one is when no is pressed and

if (mandatory<=21) { mandtory++; }

because mandatory and mandtory are not the same variable name.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 8 '06 #2
Evertjan. wrote:
Ruso wrote on 08 nov 2006 in comp.lang.javascript:
So the function works greate if i remove the lines "if (mandatory<=21)
{ mandtory++; } " there are two of them, one is when no is pressed and


if (mandatory<=21) { mandtory++; }

because mandatory and mandtory are not the same variable name.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
DAMN!!!!!! DAMN!!!!!
I spend about an hour on this stupid thing. How can I be so stupid. :(

Thanks a lot man!!!

Nov 8 '06 #3
Evertjan. said the following on 11/8/2006 11:12 AM:
Ruso wrote on 08 nov 2006 in comp.lang.javascript:
>So the function works greate if i remove the lines "if (mandatory<=21)
{ mandtory++; } " there are two of them, one is when no is pressed and


if (mandatory<=21) { mandtory++; }

because mandatory and mandtory are not the same variable name.
if (mandatory<=21){mandatory++}

might work better :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '06 #4
When i get it work with your help guys, i realized that this approach
does not suit my needs, so I switched to the array based approach.

Anyways, thanks a lot for your quick and helpfull help :)
Randy Webb wrote:
Evertjan. said the following on 11/8/2006 11:12 AM:
Ruso wrote on 08 nov 2006 in comp.lang.javascript:
So the function works greate if i remove the lines "if (mandatory<=21)
{ mandtory++; } " there are two of them, one is when no is pressed and

if (mandatory<=21) { mandtory++; }

because mandatory and mandtory are not the same variable name.

if (mandatory<=21){mandatory++}

might work better :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '06 #5
In message <4N********************@telcove.net>, Wed, 8 Nov 2006
11:49:40, Randy Webb <Hi************@aol.comwrites
>
if (mandatory<=21){mandatory++}

might work better :)
Or mandatory += mandatory<=21

Did you watch the Transit of Mercury this evening, not visible from here
for two reasons?

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Nov 8 '06 #6
Dr J R Stockton said the following on 11/8/2006 6:23 PM:
In message <4N********************@telcove.net>, Wed, 8 Nov 2006
11:49:40, Randy Webb <Hi************@aol.comwrites
>if (mandatory<=21){mandatory++}

might work better :)

Or mandatory += mandatory<=21

Did you watch the Transit of Mercury this evening, not visible from here
for two reasons?
No. To be honest, I didn't know it was happening and now it has passed
for me. I guess I will have to wait for NASA to post video of it. You
have to tell me about these things *before* they happen :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '06 #7

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

Similar topics

5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
16
by: Steve Jorgensen | last post by:
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
11
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java...
8
by: Brian Tkatch | last post by:
Server: DB2/SUN 8.1.6 Client: DB2 Connect Personal Edition (No 11) <URL:ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2winIA32v8/fixpak/FP11_WR21365/FP11_WR21365_CONPE.exe> ...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
4
by: rach | last post by:
I just started to learn C++. I copied the following code from a data structure textbook to a ".h" file and couldn't compile it. The code contains three template interfaces. One inherits another. The...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.