It just doesn't work!
Hello all.
I am new at this javascript thing. I have been working on a room area calculator that calculates room size in both square feet and square yards.
Problem is ... it doesn't work. And I don't know why.
This is what I have got:
<script LANGUAGE="JavaScript">
function roomArea() {
length = parseInt(document.areaform.length.value);
width = parseInt(document.areaform.width.value);
lengthwidth = (length*width);
document.areaform.area.value = area;
}
function roomArea2() {
length = parseInt(document.areaform.length.value);
width = parseInt(document.areaform.width.value);
lengthwidth = (length*width)/9;
document.areaform.area2.value = area2;
}
//
</script>
Length:
Width:
Square Feet:
Square Yards:
X
Any help would really be appreciated.
Thanks
http://www.contesthound.com
Contests and Sweepstakes Directory.
Jonathan Michaelson posted this at 20:44 — 14th January 2001.
They have: 10 posts
Joined: May 2000
Try this in stead of your javascript:
<script LANGUAGE="JavaScript">
function roomArea() {
var length = parseInt(document.areaform.length.value);
var width = parseInt(document.areaform.width.value);
area = (length*width);
document.areaform.area.value = area;
}
function roomArea2() {
var length = parseInt(document.areaform.length.value);
var width = parseInt(document.areaform.width.value);
area2 = (length*width)/9;
document.areaform.area2.value = area2;
}
//
</script>
and this in stead of your submit form:
<input type=button value="Submit" name=solve onClick="roomArea(); roomArea2()">
'Regards,
Jonathan Michaelson
Way to the Web Ltd
Commercial CGI Scripting
http://www.waytotheweb.com
artnow posted this at 01:37 — 15th January 2001.
They have: 32 posts
Joined: May 2000
Thanks that did the trick. I see now what I did wrong. I forgot to put the variable command? VAR and a quote and a semi-colon.
I would have spent the better part of the rest of my life finding that darn semi-colon!
Thanks again,
Bob
http://www.contesthound.com
Contests and Sweepstakes Directory.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.