jj72ny Posted February 3, 2009 Share Posted February 3, 2009 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 More sharing options...
jeffman Posted February 3, 2009 Share Posted February 3, 2009 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 More sharing options...
jj72ny Posted February 3, 2009 Author Share Posted February 3, 2009 thanks I'll try this I worked on it for about 1 1/2 hr lastnight and codn't get it right Link to comment Share on other sites More sharing options...
jj72ny Posted February 6, 2009 Author Share Posted February 6, 2009 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 More sharing options...
jeffman Posted February 6, 2009 Share Posted February 6, 2009 Start here: http://www.w3schools.com/htmldom/dom_obj_window.aspthen read about the open() method.This is as basic as it gets:win = window.open();win.document.body.innerHTML = "HELLO";If you can grab the innerHTML of the element that holds your table, you'll be golden. Link to comment Share on other sites More sharing options...
inktherapy Posted February 7, 2009 Share Posted February 7, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.