473,545 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

For loop error - object expected

When I run page I immediatley get "Object expected" message and the tag
<body onload="setfocu s()" is highlighted.

The error occurs in this snippet from within the script file

function validatePage()
{
// select the items in the TeamDivisions listbox
var i=document.Team Maintenance.Tea mDivisions.opti ons.length -1
For (i; i>=0; i--)
{document.TeamM aintenance.hidd enTeamDivisions .value +=
document.TeamMa intenance.TeamD ivisions.option s[i].value;
document.TeamMa intenance.hidde nTeamDivisions. value += ",";}

// Now validate the page
return validatePanels( );
}

I know this because if I comment out the line "For (i; i>=0;i--)", the
functions within the script file work correctly. Obviosusly in the
above snippet the 2 lines to be executed within the For loop executes
the once but I get the expected value in the hiddenTeamDivis ions
control so at least it shows that these lines do work.
The problem is why do I get the "object expected" message when this
line is not commented out?

Thanks in anticipation

Duncan

Jul 23 '05 #1
3 2368
Lee
undercups said:

When I run page I immediatley get "Object expected" message and the tag
<body onload="setfocu s()" is highlighted.

The error occurs in this snippet from within the script file

function validatePage()
{
// select the items in the TeamDivisions listbox
var i=document.Team Maintenance.Tea mDivisions.opti ons.length -1
For (i; i>=0; i--)

The keyword is "for", not "For".

Jul 23 '05 #2
undercups wrote:
When I run page I immediatley get "Object expected" message and the tag
<body onload="setfocu s()" is highlighted.

The error occurs in this snippet from within the script file

function validatePage()
{
// select the items in the TeamDivisions listbox
var i=document.Team Maintenance.Tea mDivisions.opti ons.length -1
For (i; i>=0; i--)
{document.TeamM aintenance.hidd enTeamDivisions .value +=
document.TeamMa intenance.TeamD ivisions.option s[i].value;
document.TeamMa intenance.hidde nTeamDivisions. value += ",";}

Try this:

// select the items in the TeamDivisions listbox
var x = [];
var f = document.TeamMa intenance.TeamD ivisions.option s;
var i = f.length;
while (i--){ x.push(f[i].value) }
document.TeamMa intenance.hidde nTeamDivisions. value = x.join(',');
// Now validate the page
return validatePanels( );
}

[...]

--
Rob
Jul 23 '05 #3
thanks guys

Duncan

Jul 23 '05 #4

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

Similar topics

5
5693
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ================================================================= Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'. using std::string; ^^^
5
3457
by: Nick Calladine | last post by:
Learning : Loop to list all dropdown box values on a form Can some one point me in the right direction : I have a form which I want to loop through I basically want to get all the selected values of the option tag see example below
1
10298
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member...
1
2275
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member...
4
1113
by: Fendi Baba | last post by:
I wrote a code to loop through an array and only the first item is updated. I think the sqlcommand is not updated properly in my code but I am not sure how to go about this. This is my code: Partial Class admin_batch Inherits System.Web.UI.Page Protected Sub ButtonUpdate_Click(ByVal sender As Object, ByVal e
1
3887
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a Javscript issue. but how do we, mere mortals who know nothing of anything about Java, scripts, etc, fix this? Is there a programm, does MS have any fix?...
6
5310
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. Here's a very simple example which should illustrate what I'm doing. #include <iostream> template <class T> class TestBase {
9
7507
by: pauldepstein | last post by:
On my visual c++ compiler, I compiled code which contained something like for( int i =0; i < 5; i++) { double x =5;} I expected it to give a compiler error because x is being redefined
1
2796
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 incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: --...
0
7420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7778
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.