Ejemplos en Javascript

Velocity 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 isn07 = new initArray("4b","5b","8b","8b");
isn07[0] = "~01~10.01~20.6~30.036~40.03281~51.9685~60.02237~70.01944~8";
isn07[1] = "~0100~11~260~33.6~43.281~5196.85~62.237~71.944~8";
isn07[2] = "~01.66667~10.016667~21~30.06~40.05468~53.281~60.03728~70.03240~8";
isn07[3] = "~027.78~10.2778~216.6667~31~40.9113~554.68~60.6214~70.53996~8";
isn07[4] = "~030.48~10.3048~218.29~31.097~41~560~60.68181818~70.59248~8";
isn07[5] = "~00.5080~10.00508~20.3048~30.01829~40.016667~51~60.01136~70.00987~8";
isn07[6] = "~044.7~10.447~226.82~31.609~41.467~588~61~70.86898~8";
isn07[7] = "~051.44~10.5144~230.87~31.852~41.688~5101.3~61.151~71~8";


function velCon() {
  // First, get the variables checked by the user
  for (var i = 0; i < 8; i++) {
    if (document.isnform07.veli[i].checked) {
      veli = i;
      velinm = document.isnform07.veli[i].value;
      }
    }
  for (var i = 0; i < 8; i++) {
    if (document.isnform07.velo[i].checked) {
      velo = i;
      velonm = document.isnform07.velo[i].value;
      }
    }
  // Now grab the numeric input by user and parse to be sure numeric
  useri = document.isnform07.velinp.value;
  if (useri == 0) {
    useri = 1;
    document.isnform07.velinp.value = useri;
    }
  mulstr = isn07[veli];
  picker = "~" + velo;
  ps = mulstr.indexOf(picker);
  velo++;
  picker = "~" + velo;
  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 + " " + velinm + " = " + picker + " " + velonm
  document.isnform07.velout.value = picker;
  }
// End Hiding -->
</SCRIPT>


</HEAD>

<BODY bgcolor="white">

<TABLE BORDER=1 WIDTH=486>
<TR><TD COLSPAN=10 ALIGN=CENTER><FORM NAME="isnform07"><FONT COLOR="blue"><B>Velocity 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="velinp" SIZE=30 VALUE="" onChange="velCon();"><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>cm/sec<BR><INPUT TYPE="radio" NAME="veli" VALUE="cm/sec" CHECKED onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>m/sec<BR><INPUT TYPE="radio" NAME="veli" VALUE="m/sec" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>m/min<BR><INPUT TYPE="radio" NAME="veli" VALUE="m/min" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>km/hr<BR><INPUT TYPE="radio" NAME="veli" VALUE="km/hr" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>ft/sec<BR><INPUT TYPE="radio" NAME="veli" VALUE="ft/sec" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>ft/min<BR><INPUT TYPE="radio" NAME="veli" VALUE="ft/min" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>mi/hr<BR><INPUT TYPE="radio" NAME="veli" VALUE="mi/hr" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Knots<BR><INPUT TYPE="radio" NAME="veli" VALUE="Knots" onClick = ""></TD>
<TR><TD ALIGN=CENTER><FONT COLOR="red" SIZE=1><B>To:</B></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>cm/sec<BR><INPUT TYPE="radio" NAME="velo" VALUE="cm/sec" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>m/sec<BR><INPUT TYPE="radio" NAME="velo" VALUE="m/sec" CHECKED onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>m/min<BR><INPUT TYPE="radio" NAME="velo" VALUE="m/min" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>km/hr<BR><INPUT TYPE="radio" NAME="velo" VALUE="km/hr" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>ft/sec<BR><INPUT TYPE="radio" NAME="velo" VALUE="ft/sec" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>ft/min<BR><INPUT TYPE="radio" NAME="velo" VALUE="ft/min" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>mi/hr<BR><INPUT TYPE="radio" NAME="velo" VALUE="mi/hr" onClick = ""></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT SIZE=1>Knots<BR><INPUT TYPE="radio" NAME="velo" VALUE="Knots" onClick = ""></TD>
<TR><TD COLSPAN=10 ALIGN=CENTER VALIGN=TOP><FONT SIZE=1><INPUT TYPE="button" VALUE=" Click for Conversion " onClick="velCon();"> <INPUT TYPE="reset" VALUE=" Reset Values "><BR><INPUT TYPE="text" NAME="velout" SIZE=60 VALUE="" onClick="velCon();">
</FONT></TD></TR>
</TABLE></FORM>


</body>
</html>

Conversores