Click to See Complete Forum and Search --> : help please!!!
hitman
12-22-2002, 01:56 PM
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
Zach Elfers
12-22-2002, 03:01 PM
To align tables put align="center".:)
King Pellinore
12-22-2002, 09:35 PM
Several small mistakes here:
...var inch = -5
var cm = -5
var mile = -5
...
You must have a semicolon at the end of each statement in JavaScript.
<!-------------------------------------------
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
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.
hitman
12-23-2002, 08:44 AM
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
...--------------------------------------------------------------------------------
gil davis
12-23-2002, 03:19 PM
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.