...

View Full Version : javascript calculator input box



Scott55
03-28-2012, 06:38 PM
hey guys, I have to create a scientific calculator using javascript and I am wondering how I can make it so that the equals box (box that displays the answer) cannot be manually cleared with the mouse cursor.



thanks!

Scott

Nile
03-28-2012, 06:44 PM
<input type="text" disabled="true">

Scott55
03-28-2012, 07:04 PM
thanks alot! Where exactly do I put that code? - also I am trying to make the only input into the calculator from the buttons themselves

Nile
03-28-2012, 07:19 PM
That's the HTML to make a disabled input. If you don't know where to place something like that in the markup section of your code, you should probably learn HTML before attempting javascript.

felgall
03-28-2012, 10:50 PM
<input type="text" disabled="true">



<input type="text" readonly>

would be better as then the result will not be greyed out.

Also ="true" is invalid HTML. You either specify disabled by itself to disable a field in HTML or use disabled="disabled" for XHTML.

venegal
03-29-2012, 05:16 AM
also I am trying to make the only input into the calculator from the buttons themselves

You might be interested in the calculator tutorial currently linked in my signature.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum