Jump to content

Run script onload and onchange?


Recommended Posts

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...