Results 1 to 3 of 3
  1. #1
    twinbird24 is offline Member
    Join Date
    Mar 2012
    Posts
    1
    Rep Power
    0

    Default Why doesn't my javascript calculator work?

    It can be found right here: Javascript Calculator

    I have javascript enabled on my browsers but it still doesn't work. I see the calculator but pushing the buttons does nothing :( Any help is appreciated

    My code is:
    XML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Javascript Calculator</title>
        <style>
            <!-- CSS STYLES GO HERE -->
                .container {
    			width:500px;
    			height:500px;
    		}
    		.equ {
    			width:99%;
    			height:20px;
    			font-size:20px;	
    			text-align:right;
    			margin-bottom:15px;
    		}
    		table {
    			border:1px solid black;
    			padding:5px;
    			width:100%;
    		}
    		table td {
    			margin:3px;
    			text-align:center;
    			width:20%;	
    		}
    		.buttons {
    			width:100%;
    			height:50px;
    			font-size:15px;	
    		}
    	</style>
        <script type="text/javascript" src="javascript.js">
    	</script>
    </head>
    <body>
    	<div class="container">
        	<table cellspacing="0">
            	<tr>
                	<td colspan="5"><input class="equ" type="input" disabled="disabled" id="equation" value="0"/><input type="hidden" id="previousType" value="-1"/></td>
                </tr>
                <tr>
                	<td><input class="buttons" type="button" name="sin" value="sin" onclick="solve ('sin')" /></td>
                    <td><input class="buttons" type="button" name="cos" value="cos" onclick="solve ('cos')" /></td>
                    <td><input class="buttons" type="button" name="tan" value="tan" onclick="solve('tan')" /></td>
                    <td><input class="buttons" type="button" name="sqrt" value="&radic;" onclick="solve('sqrt')" /></td>
                </tr>
                <tr>
                	<td><input class="buttons" type="button" name="back" value="&larr;" onclick="remove ();"/></td>
                    <td colspan="2"><input class="buttons" type="button" name="erase" value="C" onclick="clear_equation ();" /></td>
                    <td><input class="buttons" type="button" name="divide" value="/" onclick="equation (this.value, 1)"/></td>
                </tr>
                <tr>
                	<td><input class="buttons" type="button" name="seven" value="7" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="eight" value="8" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="nine" value="9" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="multiple" value="*" onclick="equation (this.value, 1)"/></td>
                </tr>
                <tr>
                	<td><input class="buttons" type="button" name="four" value="4" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="five" value="5" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="six" value="6" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="subtract" value="-" onclick="equation (this.value, 1)"/></td>
                </tr>
                <tr>
               	<td><input class="buttons" type="button" name="one" value="1" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="two" value="2" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="three" value="3" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="plus" value="+" onclick="equation (this.value, 1)"/></td>
                </tr>
                <tr>
                	<td colspan="2"><input class="buttons" type="button" name="zero" value="0" onclick="equation (this.value, 2)"/></td>
                    <td><input class="buttons" type="button" name="decimal" value="." onclick="equation (this.value, 3)"/></td>
                    <td><input class="buttons" type="button" name="equal" value="=" onclick="solve ('');"/></td>
                </tr>
            </table>
        </div>
    </body>
    </html>

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Why doesn't my javascript calculator work?

    javascript != java...and these are java forums. Recommend trying your luck on a javascript forum.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Why doesn't my javascript calculator work?

    Off topic, closing.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Why doesn't this work?
    By mailman in forum Java Applets
    Replies: 5
    Last Post: 01-10-2012, 01:01 PM
  2. Can't get java calculator to work
    By name in forum New To Java
    Replies: 4
    Last Post: 12-02-2011, 03:38 PM
  3. Jar doesn't work
    By mad72584 in forum New To Java
    Replies: 35
    Last Post: 08-07-2011, 05:22 PM
  4. why this doesn't work?
    By hitesh_public in forum New To Java
    Replies: 5
    Last Post: 08-09-2010, 08:07 AM
  5. Why doesn't this work?
    By Corder10 in forum New To Java
    Replies: 1
    Last Post: 07-04-2009, 10:33 PM

Posting Permissions

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