Ejemplos en Javascript

Pressure Equivalents

Conversor

<HTML>
<HEAD>

<TITLE>Ejemplos Javascript: ejemplo pr???¡ctico </TITLE>

<!-- Cut-N-Paste JavaScript from ISN Toolbox
Copyright 1996, Infohiway Server Network.  Restricted use is hereby
granted (both personal and commercial use OK so long as this code is
not *directly* sold), providing this notice is buried somewhere deep
in your HTML document.  A link to http://www.infohiway.com is always
appreciated, but is absolutely and positively not necessary. :-) -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide JavaScript from Java-Impaired Browsers
function initArray() {
  this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
    this[i] = initArray.arguments[i];
    }
  }
/* Please don't ask about this work-around. It works... We're sure arrays
    will be better supported soon. */
var isn09 = new initArray("4b","5b","8b","8b");
isn09[0] = "~01~11.0197~214.5~30.9869~40.7501~529.53~610.21~7401.8~833.49~9";
isn09[1] = "~00.9807~11~214.22~30.9678~40.7356~528.96~610.01~7394.1~832.84~9";
isn09[2] = "~00.06895~10.07031~21~30.06805~40.05171~52.036~60.7037~727.7~82.309~9";
isn09[3] = "~01.0133~11.0332~214.7~31~40.76~529.92~610.34~7407.1~833.93~9";
isn09[4] = "~01.3332~11.3595~219.34~31.316~41~539.37~613.61~7535.7~844.64~9";
isn09[5] = "~00.03386~10.03453~20.4912~30.03342~40.0254~51~60.3456~713.61~81.134~9";
isn09[6] = "~00.09798~10.09991~21.421~30.0967~40.07349~52.893~61~739.37~83.281~9";
isn09[7] = "~00.002489~10.002538~20.03609~30.002456~40.001867~50.07349~60.02540~71~80.083333~9";
isn09[8] = "~00.02986~10.03045~20.4331~30.02947~40.0224~50.8819~60.3048~712~81~9";


function preCon() {
  // First, get the variables checked by the user
  for (var i = 0; i < 9; i++) {
    if (document.isnform09.prei[i].checked) {
      prei = i;
      preinm = document.isnform09.prei[i].value;
      }
    }
  for (var i = 0; i < 9; i++) {
    if (document.isnform09.preo[i].checked) {
      preo = i;
      preonm = document.isnform09.preo[i].value;
      }
    }
  // Now grab the numeric input by user and parse to be sure numeric
  useri = document.isnform09.preinp.value;
  if (useri == 0) {
    useri = 1;
    document.isnform09.preinp.value = useri;
    }
  mulstr = isn09[prei];
  picker = "~" + preo;
  ps = mulstr.indexOf(picker);
  preo++;
  picker = "~" + preo;
  ps1 = mulstr.indexOf(picker);
  mulstr = mulstr.substring((ps + 2),ps1);
  ps = (useri * mulstr);
  picker = "";
  picker += ps
  ps1 = picker.indexOf(".");
  if (ps1 > -1) {
    // Correct for binary/floating point conversion error
    ps = ps + .000001;
    picker = "";
    picker += ps;
    ps2 = picker.indexOf("e");
    if (ps2 < 0) {
      picker = picker.substring(0,(ps1 + 6));
      }
    if (ps2 == 0 || ps2 > 0) {
      ps3 = picker.indexOf("00000");
      if (ps3 > 0) {
        picker = picker.substring(0,ps3 + 1) + picker.substring(ps2,picker.length);
        }
      }
    }
  picker = useri + " " + preinm + " = " + picker + " " + preonm
  document.isnform09.preout.value = picker;
  }
// End Hiding -->
</SCRIPT>


</HEAD>

<BODY bgcolor="white">

<TABLE BORDER=1 WIDTH=486>
<TR><TD COLSPAN=10 ALIGN=CENTER><FORM NAME="isnform09"><FONT COLOR="blue"><B>Pressure Equivalents</B></TD></TR>
<TR><TD COLSPAN=10 VALIGN=TOP><FONT SIZE=1><B>First, type the number you wish converted here: </B>
<INPUT TYPE="text" NAME="preinp" SIZE=30 VALUE="" onChange="preCon();"><BR><B>Then, click radio buttons for desired conversion:</FONT></TD></TR>
<TR><TD ALIGN=CENTER><FONT COLOR="red" SIZE=1><B>Fm:</B></FONT></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>megadynes/<BR>sq cm<BR><INPUT TYPE="radio" NAME="prei" VALUE="megadynes/sq cm" CHECKED onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>kg/<BR>sq cm<BR><INPUT TYPE="radio" NAME="prei" VALUE="kg/sq cm" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>lb/<BR>sq in<BR><INPUT TYPE="radio" NAME="prei" VALUE="lb/sq in" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>atmos-<BR>pheres<BR><INPUT TYPE="radio" NAME="prei" VALUE="atmospheres" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Hg*<BR>Meters<BR><INPUT TYPE="radio" NAME="prei" VALUE="Std Hg Col Meters" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Hg*<BR>Inches<BR><INPUT TYPE="radio" NAME="prei" VALUE="Std Hg Col Inches" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H2O*<BR>Meters<BR><INPUT TYPE="radio" NAME="prei" VALUE="Std H20 Col Meters" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H20*<BR>Inches<BR><INPUT TYPE="radio" NAME="prei" VALUE="Std H20 Col Inches" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H20*<BR>Feet<BR><INPUT TYPE="radio" NAME="prei" VALUE="Std H20 Col Feet" onClick = ""></TD></TR>
<TR><TD ALIGN=CENTER><FONT COLOR="red" SIZE=1><B>To:</B></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>megadynes/<BR>sq cm<BR><INPUT TYPE="radio" NAME="preo" VALUE="megadynes/sq cm" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>kg/<BR>sq cm<BR><INPUT TYPE="radio" NAME="preo" VALUE="kg/sq cm" CHECKED onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>lb/<BR>sq in<BR><INPUT TYPE="radio" NAME="preo" VALUE="lb/sq in" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>atmos-<BR>pheres<BR><INPUT TYPE="radio" NAME="preo" VALUE="atmospheres" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Hg*<BR>Meters<BR><INPUT TYPE="radio" NAME="preo" VALUE="Std Hg Col Meters" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Hg*<BR>Inches<BR><INPUT TYPE="radio" NAME="preo" VALUE="Std Hg Col Inches" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H2O*<BR>Meters<BR><INPUT TYPE="radio" NAME="preo" VALUE="Std H20 Col Meters" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H2O*<BR>Inches<BR><INPUT TYPE="radio" NAME="preo" VALUE="Std H20 Col Inches" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>H20*<BR>Feet<BR><INPUT TYPE="radio" NAME="preo" VALUE="Std H20 Col Feet" onClick = ""></TD></TR>
<TR><TD COLSPAN=10 ALIGN=CENTER VALIGN=TOP><FONT SIZE=1><INPUT TYPE="button" VALUE=" Click for Conversion " onClick="preCon();"> <INPUT TYPE="reset" VALUE=" Reset Values "><BR><INPUT TYPE="text" NAME="preout" SIZE=60 VALUE="" onClick="preCon();"><BR>*Standard columns of Mercury at 0<SUP>o</SUP> C, <I>g</i> = 980.665 cm/sec/sec<BR> Standard columns of Water at 60<SUP>o</SUP> F, <I>g</I> = 32.1756 ft/sec/sec
</FONT></TD></TR>
</TABLE></FORM>


</body>
</html>

Conversores