Notice: Undefined variable: root in /users/basti1012/www/index1.php on line 41
Zeit Converter

Zeit Converter

Hiermit kann man Zeit umrechnen von Millisekunden (oder stunden ,Minuten ,tage, Wochen usw....) zu stunden oder tage, Minuten usw...

Der hier verwendete Code

<html> <head> <meta charset="UTF-8" /> <!-- <script src="https://www.unitconverters.net/js/common.js"></script> --> <style> body,td,div{ font-family:arial,helvetica,sans-serif; font-size:12pt; color:#000; } body{ background:#fff; margin:0px; padding:0px; border:0; text-align: center; } h1{ color:#006633; font-size:20pt; font-weight:bold; padding:0; margin:12px 0; } #contentout{ width:990px; padding-top:5px; margin-left: auto; margin-right: auto; text-align: left; overflow:auto; } #content{ padding:0px 0px 15px 0px; width:620px; float:left; } .bigtext{ font-size: 18px; } #undctable{ border: 1px solid #ccc; border-radius: 4px; background-color: #eee; padding: 8px; margin-top: 15px; } .ucdcinput,select{ width:200px; padding:8px; border: 1px solid #000; border-radius: 4px; box-shadow: 2px 2px 3px #666; font-size: 20px; } .ucdcsubmit{ font-size: 18px; padding:6px 15px; border: 1px solid #000; border-radius: 4px; box-shadow: 2px 2px 3px #666; background-color: #006633; font-weight:bold; color: #ffffff; } .ucdcsubmit:hover{ background-color: #fff; color: #006633; } .ucresulttext{ padding: 5px 10px; font-size: 18px; } #ucresult{ margin: 2px 0px; border-radius: 5px; text-align:center; padding: 10px 5px; } </style> </head> <div id="contentout"> <div id="content"> <h1>Zeit Converter</h1> <div id="undctable"> <table align="center" cellpadding="5"> <h5>Conver</h5> <tr> <td class="bigtext" align="right">From:</td> <td ><input type="text" name="ucfrom" class="ucdcinput" id="ucfrom" onKeyUp="ucDCUpdateResult(0);" autofocus></td> <td class="bigtext" > <select id="ucfromunit"> <option value="second [s] [3.1536E+18]">second [s]</option><option value="millisecond [ms] [3.1536E+21]" selected="">millisecond [ms]</option><option value="minute [min] [5.256E+16]">minute [min]</option><option value="hour [h] [8.76E+14]">hour [h]</option><option value="day [d] [36500000000000]">day [d]</option><option value="week [5214285714285.7]">week</option><option value="month [1200000000000]">month</option><option value="year [y] [100000000000]">year [y]</option><option value="decade [10000000000]">decade</option><option value="century [1000000000]">century</option><option value="millennium [100000000]">millennium</option><option value="microsecond [µs] [3.1536E+24]">microsecond [µs]</option><option value="nanosecond [ns] [3.1536E+27]">nanosecond [ns]</option><option value="picosecond [ps] [3.1536E+30]">picosecond [ps]</option><option value="femtosecond [fs] [3.1536E+33]">femtosecond [fs]</option><option value="attosecond [as] [3.1536E+36]">attosecond [as]</option><option value="shake [3.1536E+26]">shake</option><option value="month (synodic) [1236006041191.2]">month (synodic)</option><option value="year (Julian) [99931553730.322]">year (Julian)</option><option value="year (leap) [99726775956.284]">year (leap)</option><option value="year (tropical) [99933675424.067]">year (tropical)</option><option value="year (sidereal) [99929813565.361]">year (sidereal)</option><option value="day (sidereal) [36599933916786]">day (sidereal)</option><option value="hour (sidereal) [8.7839841400286E+14]">hour (sidereal)</option><option value="minute (sidereal) [5.2703904840172E+16]">minute (sidereal)</option><option value="second (sidereal) [3.1622342904103E+18]">second (sidereal)</option><option value="fortnight [2607142857142.9]">fortnight</option><option value="septennial [14285714285.714]">septennial</option><option value="octennial [12500000000]">octennial</option><option value="novennial [11111111111.111]">novennial</option><option value="quindecennial [6666666666.6667]">quindecennial</option><option value="quinquennial [20000000000]">quinquennial</option><option value="Planck time [5.8502270636075E+61]">Planck time</option> </select> </td> </tr> <tr> <td class="bigtext" align="right">To:</td> <td ><input type="text" name="ucto" class="ucdcinput" id="ucto" onKeyUp="ucDCUpdateResult(1);"></td> <td class="bigtext" > <select id="uctounit"> <option value="second [s] [3.1536E+18]">second [s]</option><option value="millisecond [ms] [3.1536E+21]" selected="">millisecond [ms]</option><option value="minute [min] [5.256E+16]">minute [min]</option><option value="hour [h] [8.76E+14]">hour [h]</option><option value="day [d] [36500000000000]">day [d]</option><option value="week [5214285714285.7]">week</option><option value="month [1200000000000]">month</option><option value="year [y] [100000000000]">year [y]</option><option value="decade [10000000000]">decade</option><option value="century [1000000000]">century</option><option value="millennium [100000000]">millennium</option><option value="microsecond [µs] [3.1536E+24]">microsecond [µs]</option><option value="nanosecond [ns] [3.1536E+27]">nanosecond [ns]</option><option value="picosecond [ps] [3.1536E+30]">picosecond [ps]</option><option value="femtosecond [fs] [3.1536E+33]">femtosecond [fs]</option><option value="attosecond [as] [3.1536E+36]">attosecond [as]</option><option value="shake [3.1536E+26]">shake</option><option value="month (synodic) [1236006041191.2]">month (synodic)</option><option value="year (Julian) [99931553730.322]">year (Julian)</option><option value="year (leap) [99726775956.284]">year (leap)</option><option value="year (tropical) [99933675424.067]">year (tropical)</option><option value="year (sidereal) [99929813565.361]">year (sidereal)</option><option value="day (sidereal) [36599933916786]">day (sidereal)</option><option value="hour (sidereal) [8.7839841400286E+14]">hour (sidereal)</option><option value="minute (sidereal) [5.2703904840172E+16]">minute (sidereal)</option><option value="second (sidereal) [3.1622342904103E+18]">second (sidereal)</option><option value="fortnight [2607142857142.9]">fortnight</option><option value="septennial [14285714285.714]">septennial</option><option value="octennial [12500000000]">octennial</option><option value="novennial [11111111111.111]">novennial</option><option value="quindecennial [6666666666.6667]">quindecennial</option><option value="quinquennial [20000000000]">quinquennial</option><option value="Planck time [5.8502270636075E+61]">Planck time</option> </select> </td> </tr> <tr> <td>&nbsp;</td><td align="center"> <!-- <input type="hidden" name="ucfromunit" id="ucfromunit" value="day [d] [36500000000000]"> <input type="hidden" name="uctounit" id="uctounit" value="year [y] [100000000000]"> --> <input type="submit" value="Convert" class="ucdcsubmit" onclick="ucDCUpdateResult(processingType);return false;"> &nbsp; <input type="reset" value="Clear" class="ucdcsubmit"> </td> <td>&nbsp;</td> </tr> </table> <div id="ucresult" class="ucresulttext"></div> </div> </form> <script>noValidation=0;var processingType = 0;</script> <script> function isNumber(val) { val = val + ""; if (val.length < 1) return false; if (isNaN(val)) { return false; } else { return true; } } function trimAll(sString){while (sString.substring(0,1) == ' '){sString = sString.substring(1, sString.length);}while (sString.substring(sString.length-1, sString.length) == ' '){sString = sString.substring(0,sString.length-1);} return sString;} function cleanNumberInput(inVal){ var tempVal = inVal+""; while ((tempVal.indexOf(" ")>-1)||(tempVal.indexOf(" ")>-1)||(tempVal.indexOf(",")>-1)){ tempVal = tempVal.replace(" ", "").replace(" ", "").replace(",", ""); } return tempVal; } function gnumberFormat(valToBeFormated){ var gniTotalDigits = 12; var gniPareSize = 12; var valStr = "" + valToBeFormated; if (valStr.indexOf("N")>=0 || (valToBeFormated == 2*valToBeFormated && valToBeFormated == 1+valToBeFormated)) return "Error "; var i = valStr.indexOf("e") if (i>=0){ var expStr = valStr.substring(i+1,valStr.length); if (i>11) i=11; // max 11 digits valStr = valStr.substring(0,i); if (valStr.indexOf(".")<0){ valStr += "."; }else{ // remove trailing zeros j = valStr.length-1; while (j>=0 && valStr.charAt(j)=="0") --j; valStr = valStr.substring(0,j+1); } valStr += "E" + expStr; }else{ var valNeg = false; if (valToBeFormated < 0){ valToBeFormated = -valToBeFormated; valNeg = true; } var valInt = Math.floor(valToBeFormated); var valFrac = valToBeFormated - valInt; var prec = gniTotalDigits - (""+valInt).length - 1; // how many digits available after period var mult = " 1000000000000000000".substring(1,prec+2); if ((mult=="")||(mult==" ")){ mult = 1; }else{ mult = parseInt(mult); } var frac = Math.floor(valFrac * mult + 0.5); valInt = Math.floor(Math.floor(valToBeFormated * mult + .5) / mult); if (valNeg) valStr = "-" + valInt; else valStr = "" + valInt; var fracStr = "00000000000000"+frac; fracStr = fracStr.substring(fracStr.length-prec, fracStr.length); i = fracStr.length-1; // remove trailing zeros unless fixed during entry. while (i>=0 && fracStr.charAt(i)=="0") --i; fracStr = fracStr.substring(0,i+1); if (i>=0) valStr += "." + fracStr; } return valStr; } function ucParseSelectValue(inStr){ var tempArray = inStr.split("["); var ucOutArray = []; ucOutArray.push(trimAll(tempArray[0])); ucOutArray.push(trimAll(tempArray[1].replace("]",""))); if (tempArray.length>2){ ucOutArray.push(trimAll(tempArray[2].replace("]",""))); } return ucOutArray; } function ucCalculateResultNumOnly(inVal, inFrom, inTo){ var tempResult = 0; var tempInVal = inVal; var tempInFrom = inFrom+""; var tempInTo = inTo+""; if ((tempInFrom.indexOf(":")>0)||(tempInTo.indexOf(":")>0)){ tempArrayFrom = tempInFrom.split(":"); tempArrayTo = tempInTo.split(":"); if ((tempArrayFrom.length==3)||(tempArrayTo.length==3)){ // Temperature eval("tempResult = (("+inVal+"-("+tempArrayFrom[2]+"))/(("+tempArrayFrom[1]+")-("+tempArrayFrom[2]+")))*(("+tempArrayTo[1]+")-("+tempArrayTo[2]+"))+(" + tempArrayTo[2] + ");"); }else{ if (("3"==tempArrayFrom[0])||("3"==tempArrayTo[0])){ //Binary //alert("tempResult = (parseInt("+inVal+", "+tempArrayFrom[1]+")).toString("+tempArrayTo[1]+");"); eval("tempResult = (parseInt(\""+inVal+"\", "+tempArrayFrom[1]+")).toString("+tempArrayTo[1]+");"); return (tempResult+"").toUpperCase(); }else{ if (tempInFrom.indexOf(":")>0){ if (tempInTo.indexOf(":")>0){ eval("tempResult = " + tempInVal + "*" + tempArrayTo[1] + "/" + tempArrayFrom[1]); }else{ eval("tempResult = 1/" + tempInVal + "*" + tempArrayFrom[1] + "*" + tempInTo); } }else{ eval("tempResult = 1/" + tempInVal + "*" + tempInFrom + "*" + tempArrayTo[1]); } } } }else{ eval("tempResult = " + tempInVal + "*" + tempInTo + "/" + tempInFrom); } return tempResult; } function ucCalculateResult(inVal, inFrom, inTo){ if (inTo.indexOf(":")>0){ var tempUntArray = inTo.split(":"); if (tempUntArray[0]!='3'){ return gnumberFormat(ucCalculateResultNumOnly(inVal, inFrom, inTo)); }else{ return ucCalculateResultNumOnly(inVal, inFrom, inTo); } }else{ return gnumberFormat(ucCalculateResultNumOnly(inVal, inFrom, inTo)); } } function ucUpdateResult(){ var ucfromvalue = cleanNumberInput(document.getElementById("ucfrom").value); var ucfromunit = document.getElementById("ucfromunit"); var uctounit = document.getElementById("uctounit"); var ucfromunitvalue = ucfromunit.value; var uctounitvalue = uctounit.value; var uctounitID = 0; for (var i = 0; i < uctounit.options.length; i++) { if(uctounit.options[i].selected) uctounitID = i; } if (noValidation==1){ ucfromvalue = trimAll((ucfromvalue+"").toUpperCase()); var ucfromunitvalueArray = ucParseSelectValue(ucfromunitvalue); var uctounitvalueArray = ucParseSelectValue(uctounitvalue); tempBaseNum = parseInt((ucfromunitvalueArray[1]).substr(2).replace("]", "")); var tempTestStr = " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; tempRegStr = ""; if (tempBaseNum>10){ tempRegStr = "^[0-9A-"+tempTestStr.substr(tempBaseNum,1)+"]+$"; }else{ tempRegStr = "^[0-"+tempTestStr.substr(tempBaseNum,1)+"]+$"; } var reg = new RegExp(tempRegStr); if (reg.test(ucfromvalue)){ var tempResult = 1; tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[1]); document.getElementById("ucto").value = tempResult; document.getElementById("ucresult").innerHTML = "<font color='red'><b>Result:</b></font> " + ucfromvalue + " " + ucfromunitvalueArray[0] + " = " + tempResult + " " + uctounitvalueArray[0] + ""; document.getElementById("ucresult").style.color = "black"; //document.getElementById("ucresult").style.border = "2px solid #406b04"; for (var i = 0; i < uctounit.options.length; i++) { var tempArray = ucParseSelectValue(uctounit.options[i].value); var tempVal = ""; var tempResult = 0; tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], tempArray[1]); tempVal = tempArray[0] + " (" + tempResult + ")"; uctounit.options[i] = new Option(tempVal,uctounit.options[i].value); if (uctounitID==i){ uctounit.options[i].selected = true; } } }else{ if (ucfromvalue.length>0){ document.getElementById("ucresult").innerHTML = "Please provide a valid number!"; document.getElementById("ucresult").style.color = "red"; //document.getElementById("ucresult").style.border = "2px solid #406b04"; }else{ document.getElementById("ucresult").innerHTML = ""; //document.getElementById("ucresult").style.border = "2px solid #ffffff"; } document.getElementById("ucto").value = ""; for (var i = 0; i < uctounit.options.length; i++) { var tempArray = ucParseSelectValue(uctounit.options[i].value); var tempVal = ""; if (tempArray.length>2){ tempVal = tempArray[0] + " [" + tempArray[1] + "]"; }else{ tempVal = tempArray[0]; } uctounit.options[i] = new Option(tempVal,uctounit.options[i].value); if (uctounitID==i){ uctounit.options[i].selected = true; } } } }else{ if (!isNumber(ucfromvalue)){ if (ucfromvalue.length>0){ document.getElementById("ucresult").innerHTML = "Please provide a valid number!"; document.getElementById("ucresult").style.color = "red"; //document.getElementById("ucresult").style.border = "2px solid #406b04"; }else{ document.getElementById("ucresult").innerHTML = ""; //document.getElementById("ucresult").style.border = "2px solid #ffffff"; } document.getElementById("ucto").value = ""; for (var i = 0; i < uctounit.options.length; i++) { var tempArray = ucParseSelectValue(uctounit.options[i].value); var tempVal = ""; if (tempArray.length>2){ tempVal = tempArray[0] + " [" + tempArray[1] + "]"; }else{ tempVal = tempArray[0]; } uctounit.options[i] = new Option(tempVal,uctounit.options[i].value); if (uctounitID==i){ uctounit.options[i].selected = true; } } }else{ var ucfromunitvalueArray = ucParseSelectValue(ucfromunitvalue); var uctounitvalueArray = ucParseSelectValue(uctounitvalue); var tempResult = 1; if (ucfromunitvalueArray.length>2){ if (uctounitvalueArray.length>2){ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[2], uctounitvalueArray[2]); }else{ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[2], uctounitvalueArray[1]); } }else{ if (uctounitvalueArray.length>2){ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[2]); }else{ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[1]); } } document.getElementById("ucto").value = tempResult; document.getElementById("ucresult").innerHTML = "<font color='red'><b>Result:</b></font> " + ucfromvalue + " " + ucfromunitvalueArray[0] + " = " + tempResult + " " + uctounitvalueArray[0] + ""; document.getElementById("ucresult").style.color = "black"; //document.getElementById("ucresult").style.border = "2px solid #406b04"; for (var i = 0; i < uctounit.options.length; i++) { var tempArray = ucParseSelectValue(uctounit.options[i].value); var tempVal = ""; var tempResult = 0; if (tempArray.length>2){ if (ucfromunitvalueArray.length>2){ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[2], tempArray[2]); }else{ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], tempArray[2]); } tempVal = tempArray[0] + " [" + tempArray[1] + "] (" + tempResult + ")"; }else{ if (ucfromunitvalueArray.length>2){ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[2], tempArray[1]); }else{ tempResult = ucCalculateResult(ucfromvalue, ucfromunitvalueArray[1], tempArray[1]); } tempVal = tempArray[0] + " (" + tempResult + ")"; } uctounit.options[i] = new Option(tempVal,uctounit.options[i].value); if (uctounitID==i){ uctounit.options[i].selected = true; } } } } } function convertFIToFra(inRSNum, inRSUnit){ var totalInch = inRSNum; if (inRSUnit=='foot') totalInch = inRSNum * 12; var totalFeet = Math.floor(totalInch/12); var subInch = Math.floor(totalInch - (totalFeet*12)); var inchDigit = totalInch - Math.floor(totalInch); totalInch = Math.floor(totalInch); var inchFracTop = Math.round(inchDigit*64); var inchFracBottom = 64; if (inchFracTop==64){ totalInch = totalInch + 1; subInch = subInch + 1; if (subInch==12){ subInch = 0; totalFeet = totalFeet + 1; } inchFracTop = 0; }else{ if ((inchFracTop%32)==0){ inchFracTop = inchFracTop/32; inchFracBottom = 2; }else if ((inchFracTop%16)==0){ inchFracTop = inchFracTop/16; inchFracBottom = 4; }else if ((inchFracTop%8)==0){ inchFracTop = inchFracTop/8; inchFracBottom = 8; }else if ((inchFracTop%4)==0){ inchFracTop = inchFracTop/4; inchFracBottom = 16; }else if ((inchFracTop%2)==0){ inchFracTop = inchFracTop/2; inchFracBottom = 32; } } if ((totalInch+inchFracTop)<1) return ""; var finalResult = "<br>OR<br>"; if (totalFeet>0){ if (totalFeet>1){ finalResult += totalFeet + " feet "; }else{ finalResult += totalFeet + " foot "; } if (subInch>0){ if (inchFracTop>0){ finalResult += subInch + " <sup>" + inchFracTop + "</sup>/<sub>" + inchFracBottom + "</sub> inches "; }else{ if (subInch>1){ finalResult += subInch + " inches "; }else{ finalResult += subInch + " inch "; } } }else{ if (inchFracTop>0){ finalResult += " <sup>" + inchFracTop + "</sup>/<sub>" + inchFracBottom + "</sub> inch "; } } finalResult += "<br>OR<br>"; } if (totalInch>0){ if (inchFracTop>0){ finalResult += totalInch + " <sup>" + inchFracTop + "</sup>/<sub>" + inchFracBottom + "</sub> inches "; }else{ if (totalInch>1){ finalResult += totalInch + " inches "; }else{ finalResult += totalInch + " inch "; } } }else{ if (inchFracTop>0){ finalResult += " <sup>" + inchFracTop + "</sup>/<sub>" + inchFracBottom + "</sub> inch "; } } return finalResult; } function ucDCUpdateResult(usdcType){ processingType = usdcType; var ucfromvalue = cleanNumberInput(document.getElementById("ucfrom").value); var ucfromunit = document.getElementById("ucfromunit"); var uctounit = document.getElementById("uctounit"); var uctoid = document.getElementById("ucto"); if (usdcType==1){ ucfromvalue = cleanNumberInput(document.getElementById("ucto").value); ucfromunit = document.getElementById("uctounit"); uctounit = document.getElementById("ucfromunit"); uctoid = document.getElementById("ucfrom"); } var ucfromunitvalue = ucfromunit.value; var uctounitvalue = uctounit.value; if (noValidation==1){ ucfromvalue = trimAll((ucfromvalue+"").toUpperCase()); var ucfromunitvalueArray = ucParseSelectValue(ucfromunitvalue); var uctounitvalueArray = ucParseSelectValue(uctounitvalue); tempBaseNum = parseInt((ucfromunitvalueArray[1]).substr(2).replace("]", "")); var tempTestStr = " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; tempRegStr = ""; if (tempBaseNum>10){ tempRegStr = "^[0-9A-"+tempTestStr.substr(tempBaseNum,1)+"]+$"; }else{ tempRegStr = "^[0-"+tempTestStr.substr(tempBaseNum,1)+"]+$"; } var reg = new RegExp(tempRegStr); if (reg.test(ucfromvalue)){ var tempResult = 1; tempResult = ucCalculateResultNumOnly(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[1]); if (uctounitvalueArray[1].indexOf(":")>0){ var tempUntArray = uctounitvalueArray[1].split(":"); if (tempUntArray[0]!='3'){ tempResult = gnumberFormat(tempResult); } }else{ tempResult = gnumberFormat(tempResult); } uctoid.value = tempResult; document.getElementById("ucresult").innerHTML = "<font color='red'><b>Result:</b></font> " + ucfromvalue + " " + ucfromunitvalueArray[0] + " = " + tempResult + " " + uctounitvalueArray[0] + ""; document.getElementById("ucresult").style.color = "black"; //document.getElementById("ucresult").style.border = "2px solid #406b04"; }else{ if (ucfromvalue.length>0){ document.getElementById("ucresult").innerHTML = "Please provide a valid number!"; document.getElementById("ucresult").style.color = "red"; }else{ document.getElementById("ucresult").innerHTML = ""; } uctoid.value = ""; } }else{ if (!isNumber(ucfromvalue)){ if (ucfromvalue.length>0){ document.getElementById("ucresult").innerHTML = "Please provide a valid number!"; document.getElementById("ucresult").style.color = "red"; }else{ document.getElementById("ucresult").innerHTML = ""; //document.getElementById("ucresult").style.border = "2px solid #ffffff"; } uctoid.value = ""; }else{ var ucfromunitvalueArray = ucParseSelectValue(ucfromunitvalue); var uctounitvalueArray = ucParseSelectValue(uctounitvalue); var tempResult = 1; var tempResultMore = ""; if (ucfromunitvalueArray.length>2){ if (uctounitvalueArray.length>2){ tempResult = ucCalculateResultNumOnly(ucfromvalue, ucfromunitvalueArray[2], uctounitvalueArray[2]); if ((uctounitvalueArray[0]=='foot')||(uctounitvalueArray[0]=='inch')){ tempResultMore = convertFIToFra(tempResult, uctounitvalueArray[0]); } }else{ tempResult = ucCalculateResultNumOnly(ucfromvalue, ucfromunitvalueArray[2], uctounitvalueArray[1]); } }else{ if (uctounitvalueArray.length>2){ tempResult = ucCalculateResultNumOnly(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[2]); if ((uctounitvalueArray[0]=='foot')||(uctounitvalueArray[0]=='inch')){ tempResultMore = convertFIToFra(tempResult, uctounitvalueArray[0]); } }else{ tempResult = ucCalculateResultNumOnly(ucfromvalue, ucfromunitvalueArray[1], uctounitvalueArray[1]); } } tempResult = gnumberFormat(tempResult); uctoid.value = tempResult; document.getElementById("ucresult").innerHTML = "<font color='red'><b>Result:</b></font> " + ucfromvalue + " " + ucfromunitvalueArray[0] + " = " + tempResult + " " + uctounitvalueArray[0] + tempResultMore; document.getElementById("ucresult").style.color = "black"; } } } function gObj(obj) {var theObj;if(document.all){if(typeof obj=="string"){return document.all(obj);}else{return obj.style;}}if(document.getElementById){if(typeof obj=="string"){return document.getElementById(obj);}else{return obj.style;}}return null;} function popMenu(inval){ htmlVal = ""; for (i = 0; i < allA.length; i++) { if (inval == allA[i][0][0]){ htmlVal = htmlVal + "<li id='menuon'><a href='javascript:popMenu(\"" + allA[i][0][0] + "\");showSel(" + allA[i][0][1] + ");'>" + allA[i][0][0] + "</a></li> "; }else{ htmlVal = htmlVal + "<li><a href='javascript:popMenu(\"" + allA[i][0][0] + "\");showSel(" + allA[i][0][1] + ");'>" + allA[i][0][0] + "</a></li> "; } } htmlVal = "<ul>" + htmlVal + "</ul>"; gObj("menu").innerHTML = htmlVal; } function popMenuSmall(inval){ tA[0] = new Array("Temp","tA"); htmlVal = ""; for (i = 0; i < allA.length; i++) { if (inval == allA[i][0][0]){ htmlVal = htmlVal + "<li id='menuon'><a href='javascript:popMenuSmall(\"" + allA[i][0][0] + "\");showSel(" + allA[i][0][1] + ");'>" + allA[i][0][0] + "</a></li> "; }else{ htmlVal = htmlVal + "<li><a href='javascript:popMenuSmall(\"" + allA[i][0][0] + "\");showSel(" + allA[i][0][1] + ");'>" + allA[i][0][0] + "</a></li> "; } } htmlVal = "<ul>" + htmlVal + "</ul>"; gObj("menu").innerHTML = htmlVal; } var mA = new Array(); mA[0] = new Array("Time","mA"); mA[1] = new Array("Second","iv","iv"); mA[2] = new Array("Millisecond", "iv*0.001", "iv/0.001"); mA[3] = new Array("Microsecond", "iv*0.000001", "iv/0.000001"); mA[4] = new Array("Nanosecond", "iv*0.000000001", "iv/0.000000001"); mA[5] = new Array("Picosecond", "iv*0.000000000001", "iv/0.000000000001"); mA[6] = new Array("Minute", "iv*60", "iv/60"); mA[7] = new Array("Hour", "iv*3600", "iv/3600"); mA[8] = new Array("Day", "iv*86400", "iv/86400"); mA[9] = new Array("Week", "iv*604800", "iv/604800"); mA[10] = new Array("Month", "iv*2629800", "iv/2629800"); mA[11] = new Array("Year", "iv*31557600", "iv/31557600"); allA = new Array(mA); function isNum(sText){ var ValidChars = "0123456789.-"; var Char; if (sText.length < 1) return false; for (i = 0; i < sText.length; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) return false; } return true; } function showSel(aName){ document.calForm.calFrom.length = 0; document.calForm.calTo.length = 0; for(i=1; i<aName.length; i++){ document.calForm.calFrom.options[(i-1)] = new Option(aName[i][0],i); document.calForm.calTo.options[(i-1)] = new Option(aName[i][0],i); } document.calForm.calFrom.options[0].selected = true; document.calForm.calTo.options[1].selected = true; document.calForm.toVal.value = ""; currentAName = aName; calcul(); } function calVal(id, iv){ eval("rv = (" + currentAName[id][2] + ");"); return gnumberFormat(rv); } function calcul(){ selectFrom = document.calForm.calFrom; selectTo = document.calForm.calTo; fromVal = cleanNumberInput(document.calForm.fromVal.value); selectFromID = 0; selectToID = 0; selectFromVal = ""; selectToVal = ""; stdval = 0; for (var i = 0; i < selectFrom.options.length; i++) { if(selectFrom.options[i].selected) { selectFromID = selectFrom.options[i].value; selectFromVal = selectFrom.options[i].text; } } for (var i = 0; i < selectTo.options.length; i++) { if(selectTo.options[i].selected) { selectToID = selectTo.options[i].value; selectToVal = selectTo.options[i].text; } } if ((selectFromID>0) && (isNumber(fromVal))){ iv = parseFloat(fromVal); stdval = 0; eval("stdval = " + currentAName[selectFromID][1]+ ";"); document.calForm.calTo.length = 0; for(i=1; i<currentAName.length; i++){ tempVal = calVal(i, stdval); selectTo.options[(i-1)] = new Option(currentAName[i][0] + " (" + tempVal + ")",i); if (selectToID == i) { selectTo.options[(i-1)].selected = true; document.calForm.toVal.value = tempVal; //gObj("calResults").style.border = "2px solid #406b04"; gObj("calResults").innerHTML = "<font color='red'><b>Result:</b></font> " + fromVal + " " + selectFromVal + " = " + tempVal + " " + currentAName[i][0]; } } } if ((!(isNumber(fromVal)))||(selectFromID<1)){ for(i=1; i<currentAName.length; i++){ tempVal = calVal(i, stdval); selectTo.options[(i-1)] = new Option(currentAName[i][0],i); if (selectToID == i) { selectTo.options[(i-1)].selected = true; document.calForm.toVal.value = ""; //gObj("calResults").style.border = "2px solid #fff"; gObj("calResults").innerHTML = ""; } } if ((fromVal+"").length>0){ //gObj("calResults").style.border = "2px solid #406b04"; gObj("calResults").innerHTML = "<font color='red'>Please provide a valid number!</font>"; } } } </script> </body> </html>