Solved

javascript errors

Posted on 2006-10-20
4
218 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
array6 challenfge 6 83
move one pixel 4 59
recursion example 16 112
simplest php form 3 64
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now