Latest Lists

web programming question?

in microsoft word there is a button u click on in the header and footer section where for each page a number appears that acts as the page number. so obviously if your on page 1 it will say 1, page 2 it will say 2. and so on. now im doing some basic html and javascript and for my assignment i have to make a list of unordered items (which i know begins and ends with the <ul><li> text here </li></ul>) but in the "text here" area i would like to have somethin like that page number in microsft word only in javascript. for example on a webpage im supposed to have a text box where the user can type in a number and click on a button that will then lead them to a result. so if the question is "how many ingredients will you need to bake a cake" and they randomly put in the number 3, i will need to then reply with an unordered list saying "ingredient 1", "ingredient 2", "ingredient 3" i got everything but the number part of the situation. <html><head> <script language="JavaScript"> function message(num){ count=1; while (count<=num) { document.write('<ul><li>Ingredient </li> </ul>'); count = count+1; } } </script></head><body> <br> <p> </p><form name="myform"> How many ingridients do you need to bake a cake? <br> How many times do you have to write it? <input name="number" size="3" type="text"> <input value="Find Recipe" onclick="message(document.myform.number.value) " type="button"> </form> </body></html>

Public Comments

  1. huh!? What!?
  2. It's pretty tough to help you with JavaScript if we can't see your code and there's no link to a page we can view the HTML source on. Why not head over to the WebDeveloper JavaScript forum and get great help from some expert coders. You'll find tons of helpful information there.
  3. >i got everything but the number part of the situation. to prompt for a number you code var theNumber = prompt("What number","1") UPDATE: you're a lot further on than a simple prompt!!! try this: <html> <head> <title>ingredients</title> <script type="text/javascript"> function message(ings){ document.write('<h1>' + ings + ' Ingredients </h1>') document.write('<ul>') for (var i =1;i<=ings;i++){ document.write('<li> ingredient #' + i + '</li>') } document.write('</ul>') } </script> </head> <body> <form name="myform"> How many ingredients do you need to bake a cake? <br> <input name="number" size="3" type="text"> <input value="Ingredients" onclick="message( this.form.number.value )" type="button"> </form> </body> </html> </html>
  4. wow that jake is smart!
Powered by Yahoo! Answers