mdav20 Posted September 14, 2017 Report Share Posted September 14, 2017 I have the following script for onchange... I would like run it onload also, is there a easy way to do it? <SCRIPT LANGUAGE="JavaScript"> function calculate() { var current = parseFloat(document.getElementById("cbParamVirtual1").value); if (isNaN(current)) current = 0; var installed ='[@calcfield:2]'; var total_hrs ='[@calcfield:1]'; var currenttotal = parseFloat((current - installed) + parseFloat(total_hrs)); document.getElementById("cbParamVirtual2").value =Math.max(0, currenttotal); } document.getElementById("details").onchange=calculate; </SCRIPT> Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted September 15, 2017 Report Share Posted September 15, 2017 Hello mdav20, I would suggest creating the separate function, so you could call this function with a different event "onload". Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.