Solved

javascript errors

Posted on 2006-10-20
4
215 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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points refunded (125)

Computer101
EE Admin
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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 …

763 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

7 Experts available now in Live!

Get 1:1 Help Now