Jump to content

HelPp


gamecube998

Recommended Posts

<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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...