1.Adım
Bu VBScript kodlamasını Script le başlayan kodlama <HEAD> </HEAD> tag'lerinin arasına gelecek şekilde yazılmalıdır.
2.Adım:
Aşağıdaki kodları 1 adımda anlatılan yere kes yapıştır yöntemiyle kopyalayın.
-----------------------------------------------------------------
<SCRIPT LANGUAGE="VBScript">
<!--
' Module-level variables
Dim Accum ' Previous number (operand) awaiting operation
Dim FlagNewNum ' Flag to indicate a new number (operand)
is being entered
Dim PendingOp ' Pending operation waiting for completion
of second operand
Sub NumPressed(Byval Num)
If FlagNewNum Then
Document.Keypad.Readout.Value = Num
FlagNewNum = False
Else
If Document.Keypad.Readout.Value = "0"
Then
Document.Keypad.Readout.Value =
CStr(Num)
Else
Document.Keypad.ReadOut.Value=
Document.Keypad.ReadOut.Value & CStr(Num)
End If
End If
End Sub
Sub Decimal_onClick()
Dim curReadout
curReadOut = Document.Keypad.ReadOut.Value
If FlagNewNum Then
curReadOut = "0."
FlagNewNum = False
Else
If InStr(curReadOut, ".") = 0 Then
curReadOut = curReadOut & "."
End If
End If
Document.Keypad.ReadOut.Value = curReadOut
End Sub
Sub Plus_onClick()
Operation "+"
End Sub
Sub Minus_onClick()
Operation "-"
End Sub
Sub Multiply_onClick()
Operation "*"
End Sub
Sub Divide_OnClick()
Operation "/"
End Sub
Sub Operation(Byval Op)
Dim Readout
ReadOut = Document.Keypad.ReadOut.Value
If FlagNewNum and PendingOp <> "=" Then
' User is hitting op keys repeatedly,
so don't do anything
Else
FlagNewNum = True
Select Case PendingOp
Case "+"
Accum = CDbl(Accum) +
CDbl(ReadOut)
Case "-"
Accum = CDbl(Accum) -
CDbl(ReadOut)
Case "/"
Accum = CDbl(Accum) /
Dbl(ReadOut)
Case "*"
Accum = CDbl(Accum) *
CDbl(ReadOut)
Case Else
Accum = ReadOut
End Select
Document.Keypad.ReadOut.Value =
Accum
PendingOp = Op
End If
End Sub
Sub ClearEntry_onClick()
' Remove current number and reset state
Document.Keypad.ReadOut.Value = "0"
FlagNewNum = True
End Sub
Sub Clear_onClick()
' Clear accumulator and pending operation,
and clear display
Accum = 0
PendingOp = ""
ClearEntry_onClick
End Sub
Sub Neg_onClick()
Document.Keypad.ReadOut.Value =
CDbl(Document.Keypad.ReadOut.Value) * -1
End Sub
Sub Percent_onClick()
Document.Keypad.ReadOut.Value =
(CDbl(Document.Keypad.ReadOut.Value) / 100) * Accum
End Sub
Sub Equals_OnClick()
Operation "="
End Sub
-->
</SCRIPT>
--------------------------------------------------------------------3Adım: Aşağıdaki kodları <body>.</body> tag'ının ara
sına kopyalayın.
-------------------------------------------------------------------
<form action="" Name="Keypad">
<TABLE BORDER=2 WIDTH=40 HEIGHT=60 CELLPADDING=1 CELLSPACING=5>
<CAPTION ALIGN=top>
<p>
</CAPTION>
<TR>
<TD COLSPAN="3" ALIGN="CENTER"><INPUT NAME="ReadOut" TYPE="Text" SIZE=24 VALUE="0" WIDTH="100%"></TD>
<TD></TD>
<TD><INPUT NAME="Clear" TYPE="Button" VALUE=" sil " ></TD>
<TD><INPUT NAME="ClearEntry" TYPE="Button" VALUE=" CE " ></TD>
</TR>
<TR>
<TD><INPUT NAME="Seven" TYPE="Button" VALUE=" 7 " OnClick="NumPressed(7)"></TD>
<TD><INPUT NAME="Eight" TYPE="Button" VALUE=" 8 " OnClick="NumPressed(8)"></TD>
<TD><INPUT NAME="Nine" TYPE="Button" VALUE=" 9 " OnClick="NumPressed(9)"></TD>
<TD></TD>
<TD><INPUT NAME="Neg" TYPE="Button" VALUE=" +/- " ></TD>
<TD><INPUT NAME="Percent" TYPE="Button" VALUE="yüzdeal" ></TD>
</TR>
<TR>
<TD><INPUT NAME="Four" TYPE="Button" VALUE=" 4 " OnClick="NumPressed(4)"></TD>
<TD><INPUT NAME="Five" TYPE="Button" VALUE=" 5 " OnClick="NumPressed(5)"></TD>
<TD><INPUT NAME="Six" TYPE="Button" VALUE=" 6 " OnClick="NumPressed(6)"></TD>
<TD></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Plus" TYPE="Button" VALUE="topla"></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Minus" TYPE="Button" VALUE="çıkar" ></TD>
</TR>
<TR>
<TD><INPUT NAME="One" TYPE="Button" VALUE=" 1 " OnClick="NumPressed(1)"></TD>
<TD><INPUT NAME="Two" TYPE="Button" VALUE=" 2 " OnClick="NumPressed(2)"></TD>
<TD><INPUT NAME="Three" TYPE="Button" VALUE=" 3 " OnClick="NumPressed(3)"></TD>
<TD></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Multiply" TYPE="Button" VALUE="çarp" ></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Divide" TYPE="Button" VALUE=" böl " ></TD>
</TR>
<TR>
<TD><INPUT NAME="Zero" TYPE="Button" VALUE=" 0 " OnClick="NumPressed(0)"></TD>
<TD><INPUT NAME="Decimal" TYPE="Button" VALUE=" . " ></TD>
<TD COLSPAN=3></TD>
<TD><INPUT NAME="Equals" TYPE="Button" VALUE="sonuçla"></TD>
</TR>
</TABLE>
</FORM>