JavaScript - Калкулатор

Готови кодове за по-голяма атрактивност
Post Reply
User avatar
Soul_Stealler
Web-tourist
Web-tourist
Posts: 3559
Joined: Tue Dec 20, 2005 3:52 pm
Answers: 112
Location: София
Contact:

JavaScript - Калкулатор

Post by Soul_Stealler » Thu Apr 27, 2006 9:05 am

Още един скрипт :)

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">



<!-- Begin



//  DECLARE AND INITIALIZE VARIABLES

  var zero    = '0';

  var one    = '1';

  var two    = '2';

  var three = '3';

  var four    = '4';

  var five    = '5';

  var six = '6';

  var seven = '7';

  var eight = '8';

  var nine    = '9';

  var add    = '+';

  var subtract = '-';

  var multiply = '*';

  var divide = '/';

  var decimal = '.';

  var power = '^';



//  FUNCTION&#58; compute

function compute&#40;f&#41;

&#123;

  f.view.value = eval&#40;f.view.value&#41;;

&#125;



//  FUNCTION&#58; getNum

function getNum&#40;f, val&#41;

&#123;

  f.view.value += val;

&#125;



//  End -->

</script>


</HEAD>

<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 BORDERCOLOR=DDDDDD>

<TR><TD>

<TABLE CELLPADDING=7 CELLSPACING=0 BGCOLOR=AABBCC>



<!----------------------BEGIN CALCULATOR------------------------->

<FORM NAME="calc">

  <TR>

    <TD COLSPAN=2>

      <DIV ALIGN=LEFT><SMALL><FONT COLOR=000000>

      BG-78 Calculator

      </FONT></SMALL></DIV>

        <INPUT TYPE=text NAME="view" SIZE=30 action="compute&#40;this&#41;"><BR>

      <HR>

    </TD>

  </TR>



  <TR>

    <TD COLSPAN=2><DIV ALIGN=RIGHT>

        <INPUT TYPE=button VALUE="  7  " onClick="getNum&#40;this.form, seven&#41;">

        <INPUT TYPE=button VALUE="  8  " onClick="getNum&#40;this.form, eight&#41;">

        <INPUT TYPE=button VALUE="  9  " onClick="getNum&#40;this.form, nine&#41;">

        <INPUT TYPE=button VALUE="   .  " onClick="getNum&#40;this.form, decimal&#41;">

        <INPUT TYPE=reset VALUE="   C  ">

      </DIV></TD>

  </TR>      

  <TR>

      <TD COLSPAN=2><DIV ALIGN=RIGHT>

        <INPUT TYPE=button VALUE="  4  " onClick="getNum&#40;this.form, four&#41;">

        <INPUT TYPE=button VALUE="  5  " onClick="getNum&#40;this.form, five&#41;">

        <INPUT TYPE=button VALUE="  6  " onClick="getNum&#40;this.form, six&#41;">

        <INPUT TYPE=button VALUE="  *  " onClick="getNum&#40;this.form, multiply&#41;">

        <INPUT TYPE=button VALUE="   /    " onClick="getNum&#40;this.form, divide&#41;">

      </DIV></TD>

  </TR>      

  <TR>

      <TD COLSPAN=2><DIV ALIGN=RIGHT>

        <INPUT TYPE=button VALUE="  1  " onClick="getNum&#40;this.form, one&#41;">

        <INPUT TYPE=button VALUE="  2  " onClick="getNum&#40;this.form, two&#41;">

        <INPUT TYPE=button VALUE="  3  " onClick="getNum&#40;this.form, three&#41;">

        <INPUT TYPE=button VALUE="  -  " onClick="getNum&#40;this.form, subtract&#41;">

        <INPUT TYPE=button VALUE="   +   " onClick="getNum&#40;this.form, add&#41;">

      </DIV></TD>

  </TR>   

  <TR>

      <TD><DIV ALIGN=CENTER>

      <INPUT TYPE=button VALUE="  0  " onClick="getNum&#40;this.form, zero&#41;">

      </DIV>

      </TD>

      <TD>

      <DIV ALIGN=RIGHT>

        <INPUT TYPE=button VALUE="   =   " onClick="compute&#40;this.form&#41;">

      </DIV>

      </TD>

  </TR>

  <TR>

      <TD COLSPAN=2>

      <HR>

      <CENTER><SMALL><FONT COLOR=000000>

      Taffo © Copyright 2006.<BR>

      All Rights Reserved.

      </FONT></SMALL></CENTER>

      </TD>

  </TR>

</FORM>

<!------------------------END CALCULATOR---------------------------->



</TABLE>

</TD></TR></TABLE>

</center>
</BODY>
</HTML>
DEMO http://web-tourist.net/project/Soul_Ste ... lator.html

Player_pz
Много Редовен
Много Редовен
Posts: 1985
Joined: Sun Sep 25, 2005 10:14 pm
Answers: 12
Location: Пазарджик

Post by Player_pz » Thu Apr 27, 2006 9:54 am

не е зле :D

Loveeza
Нов
Нов
Posts: 1
Joined: Fri Apr 17, 2015 9:06 am

Post by Loveeza » Fri Apr 17, 2015 9:19 am

Така е , има много такива
в сайта които постнах във форуми "линкове"
Last edited by muti on Wed Mar 18, 2020 11:27 am, edited 1 time in total.
Reason: Broken links

Post Reply