Sign Up   Sign In

Join the community!
Sign in now with your Facebook account.
ForumsTechnicalThread
Forum
Advanced Search
Filter     |   View Watchlist
[ Print Friendly ] [ Watch Thread ]


JavaScripting Help... [ 1 ]
super_noob
super_noob
#1   Posted 2 years ago
    [ Reply ]   [ Quote ]
Im not sure this is the right forum but its the closest i could find. Anyways i have a script that is supposed to calculate the volume of a cone. I tried it out and it does not work. Can someone please read over this script and see if anyone can find the error. Here is the script...

<html>
<head>

<title>Cone Volume</title>

<script language="JavaScript">

function convert(cal)
{ document.cone_cal.volume.value=""
var height = parseFloat(document.cone_cal.height.value)
var radius = parseFloat(document.cone_cal.radius.value)
var volume = 1.0/3.0 * 3.14* radius * radius * height
document.cone_cal.volume.value = volume
}

</script>
</head>

<body>

<form name="cone_cal">

Height:<input type="text" name="Height" size="20">


Radius:<input type="text" name="Radius" size="20">


<input type="button" name="calculate" value="Calculate" onClick="convert()">

Volume:<input type="text" name="volume" size="20">

</body>
</html>
reedmon29
reedmon29
57 54 46
#2   Posted 2 years ago
+ 3 Cool     [ Reply ]   [ Quote ]
JavaScript+XHTML is case sensitive. So saying document.cone_cal.height is different than saying document.cone_cal.Height.
Also, although this isn't really important, you can say Math.PI instead of 3.14.
Artik2
Artik2
#3   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to reedmon29, #2:
Yeap.. it's important... after a couple of uses that round can make a huge difference with the real number.
ShotgunBoy
ShotgunBoy
#4   Posted 2 years ago
- 5 Noob     [ Reply ]   [ Quote ]
meh...
wussie
wussie
Sponsor
#5   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to ShotgunBoy, #4:

if all you have to say is a three letter word on a 5 month old thread, don't fucking post.
[ 1 ]