Jump to content

Input Button And 2 Functions


jj72ny

Recommended Posts

I am playing around with the script below and was wondering if it is posible to tag two seprate functions with the same input button <script language="javascript">function add(form) {form.d1.value = (form.a1.value) * (12) / (form.c1.value) * (2)+ (form.b1.value) * (12) / (form.c1.value) * 2 }</script><form><table border="1" align="center"><tr><td>width (gable end)<input type="text" name="a1" size=5></td><td>height<input type="text" name="b1" size=5></td><td>o/c<select name="c1"><option value="12">12<option value="16">16<option value="24">24</slect></td></tr><tr><td><input type="button" value="calculate" onclick="add(this.form)"></td><td><input type="reset" value="reset"></td></tr></table></form>

Link to comment
Share on other sites

Sure. To keep doing what you're doing, make it like this:<input type="button" value="calculate" onclick="add(this.form); other_func(this.value)"> // note the semicolonBetter practice is to assign the handler in your script:

document.getElementById("myButton").onclick = function () {	add(this.form);	other_func(this.value);	// Add as many lines as you like}----<input type="button" value="calculate" id="myButton"> <!-- note the id -->

Link to comment
Share on other sites

ok that worked thanks . I haven't had the time to check out the other pice yat gave me. can you tell me where a good place to find some info to open new window and put everything that was in the table on a seprate page after button is clicked. this sounds like something I'll have to read up on to understand how it works.

Link to comment
Share on other sites

Hi,Did you just copy paste your code or you typed it? just can't stand the tags without the end tag on it.Sorry OC here. hehehe.

I am playing around with the script below and was wondering if it is posible to tag two seprate functions with the same input button <script language="javascript">function add(form) {form.d1.value = (form.a1.value) * (12) / (form.c1.value) * (2)+ (form.b1.value) * (12) / (form.c1.value) * 2 }</script><form><table border="1" align="center"><tr><td>width (gable end)<input type="text" name="a1" size=5></td><td>height<input type="text" name="b1" size=5></td><td>o/c<select name="c1"><option value="12">12<option value="16">16<option value="24">24</slect></td></tr><tr><td><input type="button" value="calculate" onclick="add(this.form)"></td><td><input type="reset" value="reset"></td></tr></table></form>
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...