User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 455,965 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,684 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 517 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 8
Reputation: k8f1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
k8f1 k8f1 is offline Offline
Newbie Poster

Help Please help!!

  #1  
Nov 17th, 2007
Hi,

I'm trying to bulid a working (simplified) calculator using JavaScript and have got stuck. Unfortunately I'm on a time limit so any help would be appreciated. I've got this far:

<html>

<head>

<title>Calculator</title>

<script language="javascript">

var input = "";
function buttonstore(value) {
input += value;
document.Calculator.txtAns.value = input;
}


</script>

</head>

<body>

<form name="Calculator" action="">
<table border="2" width="250" bgcolor="#003366">

<tr>
<td colspan="4" width="240" height="40" align="center" valign="center"><input type="text" value="0" name="txtAns"></td>
</tr>

<tr>
<td colspan="2" width="120" height="40" align="center"><input type="button" value=" C " name="btnCanc" onClick="buttonstore()"></td>
<td width="60" height="40" align="center"><input type="button" value=" / " name="btnDiv" onClick="buttonstore(/)"></td>
<td width="60" height="40" align="center"><input type="button" value=" x " name="btnMult" onClick="buttonstore(x)"></td>
</tr>


<tr>
<td width="60" height="40" align="center"><input type="button" value=" 7 " name="btn7" onClick="buttonstore(7)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 8 " name="btn8" onClick="buttonstore(8)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 9 " name="btn9" onClick="buttonstore(9)"></td>
<td width="60" height="40" align="center"><input type="button" value=" - " name="btnSub" onClick="buttonstore(-)"></td>
</tr>

<tr>
<td width="60" height="40" align="center"><input type="button" value=" 4 " name="btn4" onClick="buttonstore(4)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 5 " name="btn5" onClick="buttonstore(5)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 6 " name="btn6" onClick="buttonstore(6)"></td>
<td width="60" height="40" align="center"><input type="button" value=" + " name="btnAdd" onClick="buttonstore(+)"></td>
</tr>

<tr>
<td width="60" height="40" align="center"><input type="button" value=" 1 " name="btn2" onClick="buttonstore(1)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 2 " name="btn5" onClick="buttonstore(2)"></td>
<td width="60" height="40" align="center"><input type="button" value=" 3 " name="btn3" onClick="buttonstore(3)"></td>
<td rowspan="2" width="60" height="80" align="center"><input type="button" value=" = " name="btnEquals" onClick="buttonstore(=)"></td>
</tr>

<tr>
<td colspan="2" width="120" height="40" align="center"><input type="button" value=" 0 " name="btn0" onclick="buttonstore(0)"></td>
<td width="60" height="40" align="center"><input type="button" value=" . " name="btnDot"></td>

</tr>
</form>
</body>

</html>


Where to next? Any ideas??

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,009
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Please help!!

  #2  
Nov 18th, 2007
Maybe this can help.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 9:06 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC