www.webdeveloper.com
Results 1 to 5 of 5

Thread: help please!!!

  1. #1
    Join Date
    Dec 2002
    Posts
    216

    help please!!!

    Hi,

    I am a very new in web programming. I have a problem with this page. When I put a question like '10 cm in inches', or ' 3 pounds in kilograms', it gives me multiple answers!
    How do I align the three tables? I tried thousands of different ways, but I still don't know how to do it. Is it possible to put the answer on the same page as the question form is? How do I do that?

    Here is the source as attachment. Can you have a look at the page?

    Give me an answer please!

    Thank you
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2002
    Posts
    631
    To align tables put align="center".

  3. #3
    Join Date
    Dec 2002
    Location
    Perth, Western Australia
    Posts
    55
    Several small mistakes here:
    Code:
    ...var inch = -5
    var cm = -5
    var mile = -5
    ...
    You must have a semicolon at the end of each statement in JavaScript.
    Code:
    <!-------------------------------------------
    You can't have a --sequence within a comment (<!-- -->)
    ____
    Ok, to display the answer on the same page, you can put a div element like this:
    <div id="answer"></div>
    and then in JavaScript you can say
    Code:
    window.document.all['answer'].innerHTML = "your HTML tags".
    this should actually work with any html tag that can have other tags inside it.
    ____
    You could let the users select your units from a list of items, using <select>, but that is too easy and the way you let them ask a question is pretty professional, artificial intelligence, cool.
    Your script is pretty long and some sections seem to repeat. You could optimise it, etc.
    ____
    Aligning tables:
    I would use one big table with the other tables within them.
    ____

    It is general knowledge that I can't explain things. So if I failed to make something clear, post and I'll try harder.

  4. #4
    Join Date
    Dec 2002
    Posts
    216
    I don't understand when u say that i did several mistakes in the code. Can you explain pleae? Or tell me what shall I put instead?




    code:--------------------------------------------------------------------------------...var inch = -5
    var cm = -5
    var mile = -5
    ...--------------------------------------------------------------------------------

  5. #5
    Join Date
    Nov 2002
    Posts
    4,473
    Originally posted by King Pellinore
    You must have a semicolon at the end of each statement in JavaScript.
    Not always. If you have more than one statement on a line, a semi-colon is required to separate the statements. However, an end-of-line character will end a javascript statement just as syntactically correct as ending it with a semi-colon.

    It helps readability and debugging if you always use them.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles