Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

javascript errors

Posted on 2006-10-20
4
Medium Priority
?
234 Views
Last Modified: 2010-04-16
Can anyone please tell me why this code block,
     <script type="text/javascript">
         var i=0
         for (i=0;i<=10;i++)
         {
            document.write("The number is " + i)
           document.write("<br />")
         }
     </script>
specifically the line "for(i=0;i<=10;i++) works with no problem while this code block,
    <SCRIPT language="Javascript">
    <!--
    function addtocombo()
        {
          var i = 0
          var selectedItem
          var selectedText
          var selectedValue
          var newoption1
          var x = 0
          var listLength=document.userslist.menuitems.length
                
          For (x=0; x<listLength; x++)
          {
              if (userslist.menuitems.options(x).selected == 1)
              {
                  selectedItem = document.userslist.menuitems.selectedIndex;
                  selectedText = document.userslist.menuitems.options[x].text;
                  selectedValue = document.userslist.menuitems.options[x].value;
                  newoption1 = new Option(selectedText, selectedValue, false, false);
                  document.userslist.selitems.options[i] = newoption1;
                  i = i + 1
              }
          }
    }

specifically the line "For (x=0; x<listLength; x++)" causes the following error during page load.

Error: missing ) after argument list
Source File: https://www.rosewalker.net/test.asp
Line: 45, Column: 16
Source Code:
    For (x=0; x<listLength; x++)
--------------|
0
Comment
Question by:Wilbat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:Wilbat
ID: 17777352
nevermind.  It's alsways right in front of you.  I keep forgetting how picky Javascript is.  It doesnt like the keyword For to be capitalized.
0
 
LVL 4

Expert Comment

by:programmer1024
ID: 17778254
Since you have solved your own problem, you can ask a moderator to close/cancel this question and refund your points.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 17962840
PAQed with points refunded (125)

Computer101
EE Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Simple Linear Regression
Starting up a Project

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question