home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 1999 July
/
www_07_1999.iso
/
prez
/
amiga
/
KidHTML1_25.lha
/
KidHTML1.25
/
Script
/
armorcalc.js
< prev
next >
Wrap
Text File
|
1998-08-25
|
2KB
|
79 lines
<!-- TWO STEPS TO INSTALL ARMOR PENETRATION CALCULATOR:
1. Paste the specified coding into the HEAD of the HTML document
2. Put the last code into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD your HTML document -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Cut-N-Paste JavaScript from ISN Toolbox
<!-- This script and many more are available online from -->
<!-- The JavaScript Source!! http://javascriptsource.com -->
<!-- Begin
var c1;
var c2;
var convert_to_degrees = (2*3.1415)/360.0;
function compute_pen(c1,c2,r,ang) {
if (is_number(r)) {
new_pen = Math.pow((c1*Math.exp(-c2*range3)),0.7);
if (is_number(ang)) {
ang = parseInt(ang);
ang = ang*convert_to_degrees;
new_pen = new_pen*Math.pow(Math.cos(ang),1.5);
}
return Math.round(new_pen);
}
else {
return "";
}
}
function is_number(a_string) {
tc = a_string.charAt(0);
if (tc == "0" || tc == "1" || tc == "2" || tc == "3" || tc == "4" || tc == "5" || tc == "6" || tc == "7" || tc == "8" || tc == "9") {
return true;
}
else {
return false;
}
}
function compute_constants(form) {
range1 =form.inputrange1.value;
range2 =form.inputrange2.value;
pen1 = form.pen1.value;
pen2 =form.pen2.value;
if (is_number(range1) && is_number(range2) && is_number(pen1) && is_number(pen2)) {
range1 = parseInt(range1);
range2 = parseInt(range2);
pen1 = parseInt(pen1);
pen2 = parseInt(pen2);
ang1 = form.ang1.value;
ang2 = form.ang2.value;
if (is_number(ang1)) {
ang1 = parseInt(ang1);
ang1 = ang1 * convert_to_degrees;
pen1 = pen1/Math.pow(Math.cos(ang1),1.5);
}
if (is_number(ang2)) {
ang2 = parseInt(ang2);
ang2 = ang2 * convert_to_degrees;
pen2 = pen2/Math.pow(Math.cos(ang2),1.5);
}
c2 = Math.log(Math.pow(pen2,1.4286)/Math.pow(pen1,1.4286))/(-range2 + range1);
temp = (range1*c2);
c1 = Math.pow(pen1,1.4286) * Math.exp(temp);
return true;
}
else {
alert("You need to enter two different ranges and the penetration at those ranges.");
return false;
}
}
function armorpen(form)