Script Categories













Calculators >>> Group Work.

Ever had to work with another person to complete a task? This calculator will tell you how long it would take two people to complete the task if you know how long it would take each person to complete the task individually.

Person one can do the job in hours
Person two can do the same job in hours
Together, they can do the job in hours

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function groupWork() {
person1 = parseInt(document.workform.person1.value);
person2 = parseInt(document.workform.person2.value);
worktime = (person1*person2)/(person1+person2);
document.workform.time.value = worktime;
}
//  End -->
</script>
<form name=workform>
<table border="0">
   <tr>
      <td>Person one can do the job in</td>
      <td><input type=text name=person1 size=5> hours</td>
   </tr>
   <tr>
      <td>Person two can do the same job in</td>
      <td><input type=text name=person2 size=5> hours</td>
   </tr>
   <tr>
      <td>Together, they can do the job in</td>
      <td><input type=text name=time size=10> hours</td>
   </tr>
</table>
<BR>
<input type=button value="Solve!" name=solve onClick="groupWork()">
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

R7


©