تبلیغات
مرکز کدهای جاوا و اچ تی ام ال - کد ماشین حساب | کاربردی

کد ماشین حساب | کاربردی

یکشنبه 11 مهر 1389 03:01 ق.ظ   نویسنده : محمد      


مرتبط با کدهای کاربردی
این کد جاوا اسکریپت یه ماشین حساب برای وبلاگتون درست می کنه

<!-- www.js.coo.ir -->
<!-- begin the script-->
<CENTER>

<FORM name="Keypad" action="">
<TABLE>
<B>
<TABLE border=2 width=50 height=60 cellpadding=1 cellspacing=5>
<TR>
<TD colspan=3 align=middle>
<input name="ReadOut" type="Text" size=24 value="0" width=100% style="float: left">
</TD>
<TD
</TD>
<TD>
<p align="center">
<input name="btnClear" type="Button" value="  C  " onclick="Clear()">
</TD>
<TD><input name="btnClearEntry" type="Button" value="  CE " onclick="ClearEntry()">
</TD>
</TR>
<TR>
<TD>
<p align="center">
<input name="btnSeven" type="Button" value="  7  " onclick="NumPressed(7)">
</TD>
<TD>
<p align="center">
<input name="btnEight" type="Button" value="  8  " onclick="NumPressed(8)">
</TD>
<TD>
<p align="center">
<input name="btnNine" type="Button" value="  9  " onclick="NumPressed(9)">
</TD>
<TD>
</TD>
<TD>
<input name="btnNeg" type="Button" value=" +/- " onclick="Neg()">
</TD>
<TD>
<p align="center">
<input name="btnPercent" type="Button" value="  % " onclick="Percent()">
</TD>
</TR>
<TR>
<TD>
<p align="center">
<input name="btnFour" type="Button" value="  4  " onclick="NumPressed(4)">
</TD>
<TD>
<p align="center">
<input name="btnFive" type="Button" value="  5  " onclick="NumPressed(5)">
</TD>
<TD>
<p align="center">
<input name="btnSix" type="Button" value="  6  " onclick="NumPressed(6)">
</TD>
<TD>
</TD>
<TD align=middle><input name="btnPlus" type="Button" value="  +  " onclick="Operation('+')">
</TD>
<TD align=middle><input name="btnMinus" type="Button" value="   -   " onclick="Operation('-')">
</TD>
</TR>
<TR>
<TD>
<p align="center">
<input name="btnOne" type="Button" value="  1  " onclick="NumPressed(1)">
</TD>
<TD>
<p align="center">
<input name="btnTwo" type="Button" value="  2  " onclick="NumPressed(2)">
</TD>
<TD>
<p align="center">
<input name="btnThree" type="Button" value="  3  " onclick="NumPressed(3)">
</TD>
<TD>
</TD>
<TD align=middle><input name="btnMultiply" type="Button" value="  *  " onclick="Operation('*')">
</TD>
<TD align=middle><input name="btnDivide" type="Button" value="   /   " onclick="Operation('/')">
</TD>
</TR>
<TR>
<TD>
<p align="center">
<input name="btnZero" type="Button" value="  0  " onclick="NumPressed(0)">
</TD>
<TD>
<p align="center">
<input name="btnDecimal" type="Button" value="   .  " onclick="Decimal()">
</TD>
<TD colspan=3>
</TD>
<TD>
<p align="center">
<input name="btnEquals" type="Button" value="  =  " onclick="Operation('=')">
</TD>
</TR>
</TABLE>
</TABLE>
</B>
</FORM>
</CENTER>
<font face="Verdana, Arial, Helvetica" size=2>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var FKeyPad = document.Keypad;
var Accumulate = 0;
var FlagNewNum = false;
var PendingOp = "";
function NumPressed (Num) {
if (FlagNewNum) {
FKeyPad.ReadOut.value  = Num;
FlagNewNum = false;
   }
else {
if (FKeyPad.ReadOut.value == "0"<img border="0" src="Http://mihanblog.com/Yahoo/3.Gif">
FKeyPad.ReadOut.value = Num;
else
FKeyPad.ReadOut.value += Num;
   }
}
function Operation (Op) {
var Readout = FKeyPad.ReadOut.value;
if (FlagNewNum && PendingOp != "="<img border="0" src="Http://mihanblog.com/Yahoo/3.Gif">;
else
{
FlagNewNum = true;
if ( '+' == PendingOp )
Accumulate += parseFloat(Readout);
else if ( '-' == PendingOp )
Accumulate -= parseFloat(Readout);
else if ( '/' == PendingOp )
Accumulate /= parseFloat(Readout);
else if ( '*' == PendingOp )
Accumulate *= parseFloat(Readout);
else
Accumulate = parseFloat(Readout);
FKeyPad.ReadOut.value = Accumulate;
PendingOp = Op;
   }
}
function Decimal () {
var curReadOut = FKeyPad.ReadOut.value;
if (FlagNewNum) {
curReadOut = "0.";
FlagNewNum = false;
   }
else
{
if (curReadOut.indexOf("."<img border="0" src="Http://mihanblog.com/Yahoo/3.Gif"> == -1)
curReadOut += ".";
   }
FKeyPad.ReadOut.value = curReadOut;
}
function ClearEntry () {
FKeyPad.ReadOut.value = "0";
FlagNewNum = true;
}
function Clear () {
Accumulate = 0;
PendingOp = "";
ClearEntry();
}
function Neg () {
FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;
}
function Percent () {
FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate);
}
// End -->
</SCRIPT></font>

<!--end of the script-->
<!-- www.js.coo.ir -->


آخرین ویرایش: دوشنبه 12 مهر 1389 10:42 ب.ظ
دیدگاه ها ()
دوشنبه 5 شهریور 1397 11:38 ب.ظ
Hello, yes this post is genuinely good and I have learned lot of things from it concerning blogging.
thanks.
چهارشنبه 3 مرداد 1397 07:09 ق.ظ
obviously like your website but you need to test the spelling on quite a few of your posts.
Several of them are rife with spelling issues and I to
find it very bothersome to tell the reality however I will certainly come back again.
یکشنبه 31 تیر 1397 12:52 ق.ظ
Hey! Someone in my Myspace group shared this site with us so I
came to look it over. I'm definitely loving the information. I'm bookmarking and will
be tweeting this to my followers! Exceptional blog and wonderful design and style.
جمعه 17 فروردین 1397 08:24 ب.ظ

Whoa quite a lot of valuable facts!
cialis billig we use it cialis online store buy cialis online cialis 5mg billiger price cialis wal mart pharmacy cialis prices cialis professional from usa buy cialis cialis 5 mg para diabeticos order cialis from india
جمعه 3 فروردین 1397 04:59 ب.ظ

Terrific posts. Kudos.
cialis free trial cialis coupons printable buy cialis online best generic drugs cialis cialis therapie generic cialis in vietnam cialis prezzo al pubblico callus cialis ahumada cialis 10mg prix pharmaci
یکشنبه 27 اسفند 1396 11:53 ب.ظ

Thanks. Loads of facts!

look here cialis cheap canada prices for cialis 50mg buy online cialis 5mg cialis 5 mg cialis italia gratis cialis mit grapefruitsaft prix cialis once a da enter site 20 mg cialis cost cialis kamagra levitra cialis canada
شنبه 7 مرداد 1396 12:51 ق.ظ
Great blog you've got here.. It's hard to find high quality writing like
yours these days. I really appreciate individuals like
you! Take care!!
جمعه 16 تیر 1396 05:26 ق.ظ
Glad to be one of several visitants on this awful site :D.
یکشنبه 31 اردیبهشت 1396 04:42 ق.ظ
Very good info. Lucky me I ran across your blog by chance
(stumbleupon). I have saved it for later!
چهارشنبه 23 فروردین 1396 02:15 ب.ظ
My brother suggested I would possibly like this website. He was once totally right.
This post truly made my day. You cann't imagine just how so
much time I had spent for this information! Thanks!
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر

درباره وبلاگ


نویسندگان

  • محمد (64)