gamecube998 Posted March 23, 2006 Share Posted March 23, 2006 <head>DAYS OLD<br><img src="http://www.owlhouse.co.za/images/old-man.jpg"width="306" height="460"><script>function math(){var a=document.getElementById('1').value;var b=document.getElementById('2').value;var c=52.177457;var d=365.242199;var e=8765.81277;var f=525948.766 var g=31556926;var h=31556926000;var i=a*cvar j=a*dvar k=a*evar l=a*fvar m=a*galert("Hello "+b+" you are" + '\n' + ""+i+" weeks old" + '\n' + ""+j+" days old" + '\n' + ""+k+" hours old" + '\n' + ""+l+" minutes old" + '\n' + ""+m+" milliseconds old")}</script></head><body><form>age <input type="text" id="1" /><br />Your name <input type="text" id="2" /><br /><input type="button" value="clickkey" onclick="math()" /></form></body> <footer>© GCN998 2006 i was making that for no reason i was just bored and i was wondering how you made all the numbers commas Link to comment Share on other sites More sharing options...
Rachit Shah Posted March 24, 2006 Share Posted March 24, 2006 I could not get your point. Why did you put the title as Help Link to comment Share on other sites More sharing options...
scott100 Posted March 24, 2006 Share Posted March 24, 2006 He yeh go, will nicely format numbers with a comma1000000 = 1,000,000 <head>DAYS OLD<br><img src="http://www.owlhouse.co.za/images/old-man.jpg"width="306" height="460"><script>function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec;y.splice(z, 0, pnt);while (z > 3) { z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}function math(){var a=document.getElementById('1').value;var b=document.getElementById('2').value;var c=52.177457;var d=365.242199;var e=8765.81277;var f=525948.766 var g=31556926;var h=31556926000;var i=a*cvar j=a*dvar k=a*evar l=a*fvar m=a*gi=formatNumber(i,2,',','.','','','-','');j=formatNumber(j,2,',','.','','','-','');k=formatNumber(k,2,',','.','','','-','');l=formatNumber(l,2,',','.','','','-','');m=formatNumber(m,2,',','.','','','-','');alert("Hello "+b+" you are" + '\n' + ""+i+" weeks old" + '\n' + ""+j+" days old" + '\n' + ""+k+" hours old" + '\n' + ""+l+" minutes old" + '\n' + ""+m+" milliseconds old")}</script></head><body><form>age <input type="text" id="1" /><br />Your name <input type="text" id="2" /><br /><input type="button" value="clickkey" onclick="math()" /></form></body> <footer>© GCN998 2006 Link to comment Share on other sites More sharing options...
gamecube998 Posted March 25, 2006 Author Share Posted March 25, 2006 ahh i c thanks a lot Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now