»
EnglishFrenchVietnamese

Print - Down To 1 - JavaScriptBank.com

Full version: jsB@nk » Misc » Down To 1
URL: https://www.javascriptbank.com/down-to-1.html

Down To 1 © JavaScriptBank.comThe JavaScript runs through a sequence of numbers in the input box to gradually reduce the number to 1.

Full version: jsB@nk » Misc » Down To 1
URL: https://www.javascriptbank.com/down-to-1.html



CSS
<style type="text/css">td{font-family:verdana,arial,helvetica; font-size:10pt; color:#000000}a{font-family:verdana,arial,helvetica; font-size:10pt; color:#003399; font-weight:normal}a:hover{font-family:verdana,arial,helvetica; font-size:10pt; color:#0066CC; font-weight:normal}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="JavaScript">/*Down To 1 JavaScript,By Premshree Pillai*/var delay = 1000;function down(num) {if(num % 2 == 0)num /= 2;elsenum = num * 3 + 1;document.numForm.numVal.value = num;if(num > 1)setTimeout("down('"+num+"')",delay);}function changeDelay(num) {delay += num;if(delay < 0) delay = 0;}function checkString() {var loc=document.location.href.split("?");if(loc.length>1) {URI=loc[1].split("=");if(URI.length>1) {var retURI="";for(var i=1; i<URI.length; i++) retURI+=URI[i];down(retURI,delay);}}}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onLoad="checkString()"><form name="numForm"><input type="text" name="numVal"><input type="submit" value="Click!"><input type="button" value="Reset" onClick="location.href='down1.htm'"><input type="button" value="&lt;&lt;" onClick="changeDelay(100)" title="Decrease Speed"><input type="button" value="&gt;&gt;" onClick="changeDelay(-100)" title="Increase Speed"></form></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->