SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    New Zealand
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry I cant seem to figure this while... Its eating me :|

    I am becomin reallly frustrated with this, In Firefox it says that i am
    Error: missing while after do-loop body
    Source File: program5.html
    Line: 62
    Source Code:
    function tablehead()
    Heres my code(the entire thing..yea sorry for those people who are against the whole thing about people posting their entire source code)

    PHP Code:
     
    <html><head><title>Program 5</title></head><body><script language="JavaScript">/*Author: Alkaif KhanStu-ID: 0422371Date  : 26/05/04*///Set the deafault value for most books and pages to zerovar mostbooks=0;var mostpages=0;//This function fills in the data function tabledata(){  do {    //Create random data for our table    var booksread=Math.floor(Math.random()*16)    var pagesread=(Math.floor(Math.random()*101)+100*booksread)    var readername;        //Create User prompt and hold entered data into variable readername    readername = prompt('Please Enter The Reader Name','Enter Name Here');    //Create table data    document.write('<tr>');    document.write('<td>'+readername+'</td><td>'+booksread+'</td><td>'+pagesread+'</td>');    document.write('</tr>');        //hold highest book read data(name and pages read) in variables    if(booksread>mostbooks) {      mostbooks=booksread;      book_reader=readername;    }    if(pagesread>mostpages) {      mostpages=pagesread;      page_reader=readername;    }       var yesno=prompt('Do you Wish to add another reader?',                     'please type in yes or no'                    );    while(yesno!="no")    if(yesno!="no") {      document.write('</table>');      document.write('<br>');      document.write('Maximum number of books read: '+mostbooks+' by '+book_reader+'<br>');      document.write('Maximum number of books read: '+mostpages+' by '+page_reader+'<br>');    }}//This custom function creates the table fieldfunction tablehead() {   document.write('<font face="verdana" size="2pt">Girls Book Club</font>');   document.write('<table width="70%" cellspacing="1" cellpadding="1">');   document.write('<tr>');   document.write('<td>Name</td><td>Number of Books Read</td><td>Number of Pages read</td>');   document.write('</tr>');      //Use the second function table data to fill in the data   tabledata();}tablehead()</script></body></html> 
    So umm...Whats the problem?

  2. #2
    SitePoint Addict Guimauve's Avatar
    Join Date
    Aug 2004
    Location
    Chicago
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't mind if you post the whole code, but is there a way you can do it so it isn't one long line?? I don't feel like inserting all the line-breaks myself.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •