Solved

javascript errors

Posted on 2006-10-20
4
227 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

This is about my first experience with programming Arduino.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?

734 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