I'm trying to create a page that includes two javascript 'calories burned' type scripts on the same page. One covers calories burned while exercising, the other while working. Each uses the same script. If I run each one on separate pages, each works. But if I combine them on the same page, I get javascript errors. I've tried having both instances of the script on and having just one instance of the script with both forms.
The script used is:
I'll cut out most of the options in the forms to save space here. The forms used areCode:<SCRIPT LANGUAGE="JavaScript"> <!-- function FigureBURN(form, pounds, minutes, activity) { Weight = (pounds / 2.2) Time = minutes activity = document.BURN.activity.options[document.BURN.activity.selectedIndex].value form.calcval.value = (Math.round(Weight * activity)*(Time / 60)) } // --> </SCRIPT>
andCode:<FORM NAME="BURN"> WEIGHT (pounds) <INPUT TYPE="TEXT" NAME="pounds" SIZE=5><br> MINUTES WORKED: <INPUT TYPE="TEXT" NAME="minutes" SIZE=5><BR> WORK <SELECT NAME="activity"> <OPTION selected value="4"> Bakery, general <OPTION value="3.5"> Carpentry, general </select> <br><br> <INPUT TYPE="BUTTON" name="calc" value="I burn" onClick="FigureBURNa(this.form,this.form.pounds.value, this.form.minutes.value,this.form.activity.value)"> <INPUT TYPE="TEXT" name="calcval" size=10> calories at work! </FORM>
Can anyone suggest a way to make this work on the same page?Code:<FORM NAME="BURN"> WEIGHT (pounds) <INPUT TYPE="TEXT" NAME="pounds" SIZE=5><br> MINUTES EXERCISED <INPUT TYPE="TEXT" NAME="minutes" SIZE=5><BR> EXERCISE <SELECT NAME="activity"> <OPTION selected value="5"> Aerobics: low impact <OPTION value="7"> Aerobics: high impact </select> <BR><BR> <INPUT TYPE="BUTTON" name="calc" value="I burn " onClick="FigureBURN(this.form,this.form.pounds.value, this.form.minutes.value,this.form.activity.value)"> <INPUT TYPE="TEXT" name="calcval" size=10> calories at the gym. </FORM>
thanks![]()




Bookmarks