Results 1 to 4 of 4

Thread: Was bored

  1. #1
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default Was bored

    I have nothing else to do at this moment in time, so I've decided to post some terrible small script which I wrote in one of my *lessons* at school today (instead of doing work). Sorry in advance as I rushed to finish this without checking it carefully, and there may be some errors.
    HTML Code:
    <html>
    <head>
    <title>Calculator</title>
    <style language="css" type="text/css">
    .button_off{
    	width: 50px;
    	background-color: #eee;
    }
    .button_on{
    	width: 50px;
    	background-color: #ccc;
    }
    .button_clear{
    	width: 50px;
    	background-color: #d33;
    }
    .disp {
    	width: 200px;
    	margin-bottom: 5px;
    	background-color: #efefef;
    	color: #000;
    }
    </style>
    <script language="JavaScript" type="text/JavaScript">
    
    process = 'FALSE'; // Default
    clear = 'FALSE'; // Default
    
    function ac(c)
    {
    	if(clear == 'TRUE'){
    	 calc.disp.value = '';
    	 clear = 'FALSE';
    	}
    
    	document.calc.add.disabled = false;
    	document.calc.sub.disabled = false;
    	document.calc.div.disabled = false;
    	document.calc.mul.disabled = false;
    	document.calc.clr.disabled = false;
    	document.calc.equ.disabled = false;
    
    	calc.disp.value = calc.disp.value+c;
    }
    
    function ao(o)
    {
    	if(o == 'clr') {
    
    		calc.disp.value = '';
    
    		document.calc.add.disabled = true;
    		document.calc.sub.disabled = true;
    		document.calc.div.disabled = true;
    		document.calc.mul.disabled = true;
    		document.calc.clr.disabled = true;
    		document.calc.equ.disabled = true;
    
    		process = 'FALSE';
    
    	} else if(process == 'FALSE') {
    
    		mem = calc.disp.value;
    		opp = o;
    		process = 'TRUE';
    		clear = 'TRUE';
    
    	} else {
    
    		if(opp == 'mul') {
    		 calc.disp.value = mem * calc.disp.value;
    		}else if(opp == 'div') {
    		 calc.disp.value = mem / calc.disp.value;
    		}else if(opp == 'sub') {
    		 calc.disp.value = mem - calc.disp.value;
    		}else if(opp == 'add') {
    		 calc.disp.value = Number(mem) + Number(calc.disp.value);
    		}
    
    		if(o != 'equ') {
    		 opp = o;
    		 mem = calc.disp.value;
    		} else {
    		 process = 'FALSE';
    		 clear = 'TRUE';
    		}
    	}
    }
    </script>
    </head>
    <body>
    <form name="calc">
    <table cellpadding="0" cellspacing="0">
    <tr>
    <td colspan="4"><input type="text" class="disp" disabled name="disp" /></td>
    </tr>
    <tr>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="7" onClick="ac('7')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="8" onClick="ac('8')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="9" onClick="ac('9')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" disabled name="mul" value="*" onClick="ao('mul')" /></td>
    </tr>
    <tr>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="4" onClick="ac('4')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="5" onClick="ac('5')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="6" onClick="ac('6')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" disabled name="add" value="+" onClick="ao('add')" /></td>
    </tr>
    <tr>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="1" onClick="ac('1')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="2" onClick="ac('2')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="3" onClick="ac('3')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" disabled name="div" value="/" onClick="ao('div')" /></td>
    </tr>
    <tr>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" value="0" onClick="ac('0')" /></td>
    <td><input type="button" class="button_clear" disabled name="clr" value="C" onClick="ao('clr')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" disabled name="equ" value="=" onClick="ao('equ')" /></td>
    <td><input type="button" class="button_off" onmouseover="className='button_on'" onmouseout="className='button_off'" disabled name="sub" value="-" onClick="ao('sub')" /></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    P.s. It doesn't take too much brain-power to figure out the purpose of this script, so I'll leave that to you.
    Last edited by nets; 22-02-2006 at 09:52 PM.
    kinda quit.

  2. #2
    Join Date
    Mar 2005
    Location
    Newcastle-Under-Lyme
    Posts
    8,924
    Tokens
    0

    Latest Awards:

    Default

    <title>Calculator</title>
    Gives it away.
    and didn't you make one for habbox?
    Last edited by Wootzeh; 22-02-2006 at 09:53 PM.

  3. #3
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I haven't made a Calculator for Habbox which is in service. I made them a Rare values calculator which calculated the value of your rares in hcs (you typed in the quantity of each rare you own), but I deleted that script and I believe Habbox lost it.
    kinda quit.

  4. #4
    Join Date
    Jun 2005
    Location
    Manchester
    Posts
    3,187
    Tokens
    0

    Latest Awards:

    Default

    Hey,

    Josh you are such a random person. Love the script though

    - Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •