Search the Community

Showing results for tags 'loops'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 4 results

  1. The comment basically has my issue, but I'm basically trying to fix my second var prompt so it will actually run and I can't figure it out. If anyone can help I would greatly appreciate it. Line comment: var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? <!DOCTYPE html> <html> <head> <title>Project 1 – Michael Fiorello</title> <script> do{ var input = prompt ("Please enter 1, 2, 3, or exit.");{ if (input == "1") {for var one = prompt ("Please enter a string"); //var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? if (one != null) else console.warn("You need to enter something") }in(one !="") //need the above "in" to cause it to loop this section until something is entered for var one else if (input == "2") { alert ("COOL!") } else if (input == "3") { alert ("AWESOME!") } else if (input.toLowerCase() == "exit") { alert ("Okay") } else { alert ("Nope") console.warn("You need to enter something"); } } }while(input != "exit"); </script> </head> <body> </body> </html>
  2. I have a function that calls another function inside a "for" loop. The second function uses setInterval() to display and update a countdown clock on the web page. The user sets the time on the countdown clock in minutes, and also sets the number of times the loop will operate (how many countdown clocks). I want the code in the first function to wait until the clock reaches zero before continuing. function firstFunction(){ for(I=1; I<count; I++){ some code... secondFunction(); more code... } My one idea was to create a global variable/flag with a "while" loop with nothing inside the brackets just after calling the second function. In the second function, I would set the flat to "Y" when the timer reaches zero. But, the web page just locks up. while (flag=="N"){ }; Help would be appreciated.
  3. Hi, I just started to study javascript and I came across in one of your page to the following notation: var text=""; The page is from w3school tutorial: http://www.w3schools.com/js/tryit.asp?filename=tryjs_loop_for_ex I do not understand what it means and why should be used in the loop of the above example. I tried to define var text; in its place but the result is: undefinedThe number is 0The number is 1The number is 2The number is 3The number is 4 The only difference is the world 'undefined' at the beginning of the first line. Many thanks in advance for your help
  4. How do I set this kind of loop? First, it fills the cell with the data from the database. <table border="1"><tr><td>Row 1, cell 1</td></tr></table> Then, if there is more data added into the database. <table border="1"><tr><td>Row 1, cell 1</td><td>Row 1, cell 2</td></tr></table> Here's where I want the loop to start. I want it to repeat the process when the row has two cells by creating a new row.