Script Categories













Calculators >>> Radioactive.

Use JavaScript to find how much radioactive material remains after a given time.

Halflife Amount Time

The amount remaining is: or percent of the original sample.

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 computeamount(h,a,t){ 
h
= document.radio.h.value 
a
= document.radio.a.value 
t
= document.radio.t.value 
document.radio.result1.value=eval(a*Math.exp((Math.log(0.5)/h)*t)); 
document.radio.result2.value=eval((document.radio.result1.value/a)*100);   
}
// End -->
</script>
<TABLE border=1>
<TR>
<TD>Halflife</TD>
<TD>Amount</TD>
<TD>Time</TD>
</TR>
<TR>
<TD><FORM name="radio" id="radio"><input name="h" size=10 ></TD>
<TD><input name="a" size=10 ></TD>
<TD><input name="t" size=10 ></TD>
<TD><input type="button" value="Calculate Amount Left" onclick="computeamount()"></TD>
</TR>
</TABLE>
<BR>The amount remaining is:
<input name="result1" size=22> or
<input name="result2" size=5> percent of the original sample.
<input type="reset" value="Reset Form">
</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


©