javascript - Where is the onclick function in this HTML snippet defined? -
read code on htmlcodetutorial.com:
<form> <table border cellpadding=3> <tr> <td><nobr>radius: <input name="circle_radius" size=4></nobr></td> <td><input type=button onclick="circle_calc(this.form);" value="calculate"></td> <td align=right bgcolor="#aaccff"> <nobr>circumference: <input name="circle_circumference" size=9></nobr><br> <nobr>area: <input name="circle_area" size=9></nobr></td> </tr> </table> </form>
i can’t understand onclick="circle_calc(this.form);"
circle_calc(this.form)
isn't defined anywhere. how function work? built-in function in html?
it's not built-in. if @ source code, it's defined as:
<script type="text/javascript"> <!-- function circle_calc(geoform) { var circleradius = geoform.circle_radius.value; if (circleradius >= 0) { geoform.circle_circumference.value = 2 * math.pi * circleradius ; geoform.circle_area.value = math.pi * math.pow(circleradius, 2) ; } else { geoform.circle_circumference.value = ""; geoform.circle_area.value = ""; } } //--> </script>
Comments
Post a Comment