Código fuente de 'Calculadora 2.asp'
<html>
<head>
<title>Calculadora 2 - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
<%'
' Name: Fully working calculator
' Description:This is a fully working calculator,
' i downloaded martin castañeda's calulator and expanded on it
' (hope you dont mind martin). I have only been learning vbscript
' for a few months and this shows just what newbies can be capable
' of.
' By: Dazfish
%>
<SCRIPT language=vbscript>
<!--
Dim operator, buffer, operation
Dim mem1, mem2, mem3, mem4
Sub one_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="1"
if operation=0 Then display.value=display.value+"1"
operation=0
End Sub
Sub two_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="2"
if operation=0 Then display.value=display.value+"2"
operation=0
End Sub
Sub three_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="3"
if operation=0 Then display.value=display.value+"3"
operation=0
End Sub
Sub four_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="4"
if operation=0 Then display.value=display.value+"4"
operation=0
End Sub
Sub five_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="5"
if operation=0 Then display.value=display.value+"5"
operation=0
End Sub
Sub six_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="6"
if operation=0 Then display.value=display.value+"6"
operation=0
End Sub
Sub seven_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="7"
if operation=0 Then display.value=display.value+"7"
operation=0
End Sub
Sub eight_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="8"
if operation=0 Then display.value=display.value+"8"
operation=0
End Sub
Sub nine_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="9"
if operation=0 Then display.value=display.value+"9"
operation=0
End Sub
Sub zero_onclick
if display.value="0" Then display.value=""
if opeation=1 Then display.value="0"
if operation=0 Then display.value=display.value+"0"
operation=0
End Sub
Sub point_onclick
if operation=1 Then display.value="0."
if operation=0 Then display.value=display.value+"."
operation=0
End Sub
Sub pi_onclick
if display.value="0" Then display.value=""
if operation=1 Then display.value="3.14159265359"
if operation=0 Then display.value=display.value+"3.14159265359"
operation=0
End Sub
Sub plusminus_onclick
display.value=0-display.value
End Sub
Sub plus_onclick
determine()
operator="plus"
operation=1
End Sub
Sub minus_onclick
determine()
operator="minus"
operation=1
End Sub
Sub multiply_onclick
determine()
operator="multiply"
operation=1
End Sub
Sub divide_onclick
determine()
operator="divide"
operation=1
End Sub
Sub square_onclick
determine()
operator="square"
operation=1
equals()
End Sub
Sub cmdsin_onclick
determine()
operator="sin"
equals()
End Sub
Sub cmdcos_onclick
determine()
operator="cos"
equals()
End Sub
Sub cmdtan_onclick
determine()
operator="tan"
equals()
End Sub
Sub equals()
determine()
operator=""
display.value=buffer
operation=1
End Sub
Sub clear_onclick
ready()
End Sub
Sub back_onclick
display.value = left(display.value,len(display.value)-1)
if display.value="" Then display.value="0"
End Sub
Sub ready()
buffer=""
operator=""
display.value="0"
End Sub
Sub determine()
Dim result
if Not isnumeric(display.value) Then display.value="0"
if Not isnumeric(buffer) Then buffer="0"
if operator="" Then result=display.value
if operator="plus" Then result = csng(buffer) + csng(display.value): display.value = result
if operator="minus" Then result = csng(buffer) - csng(display.value): display.value = result
if operator="multiply" Then result = csng(buffer) * csng(display.value): display.value = result
if operator="divide" Then result = csng(buffer) / csng(display.value): display.value = result
if operator="square" Then result = csng(display.value)*csng(display.value): display.value = result
if operator="sin" Then result = csng(sin(display.value/57.2957795131)): display.value = result
if operator="cos" Then result = csng(cos(display.value/57.2957795131)): display.value = result
if operator="tan" Then result = csng(tan(display.value/57.2957795131)): display.value = result
buffer=result
End Sub
Sub m1_onclick
if mem1="" Then mem1=display.value: Exit Sub
display.value=mem1
End Sub
Sub m2_onclick
if mem2="" Then mem2=display.value: Exit Sub
display.value=mem2
End Sub
Sub m3_onclick
if mem3="" Then mem3=display.value: Exit Sub
display.value=mem3
End Sub
Sub m4_onclick
if mem4="" Then mem4=display.value: Exit Sub
display.value=mem4
End Sub
Sub mcl_onclick
sure=msgbox ("Are you sure you wish To clear all memory?",4)
if sure=7 Then Exit Sub
mem1=""
mem2=""
mem3=""
mem4=""
End Sub
-->
</SCRIPT>
</HEAD>
<BODY onLoad="ready()">
<CENTER>
<b><font face="Arial">Calculadora 2 </font></b>
<P>
<TABLE cellspacing=0 cellpadding=0 border=14>
<TR>
<TD align=left>
<TABLE cellspacing=0 cellpadding=2 border>
<TR>
<TD align=center><INPUT type=button name="m1" value="M1"></TD>
<TD align=center><INPUT type=button name="off" value=" Off " onClick=window.close()></TD>
</TR><TR>
<TD align=center><INPUT type=button name="m2" value="M2"></TD>
<TD align=center><INPUT type=button name="square" value="²"></TD>
</TR><TR>
<TD align=center><INPUT type=button name="m3" value="M3"></TD>
<TD align=center><INPUT type=button name="cmdsin" value=" sin "></TD>
</TR><TR>
<TD align=center><INPUT type=button name="m4" value="M4"></TD>
<TD align=center><INPUT type=button name="cmdcos" value=" cos "></TD>
</TR><TR>
<TD align=center><INPUT type=button name="mcl" value="Mcl"></TD>
<TD align=center><INPUT type=button name="cmdtan" value=" tan "></TD>
</TR>
</TABLE>
</TD>
<TD width=30>
</TD>
<TD align=right>
<TABLE cellspacing=0 cellpadding=2 border>
<TR>
<TD align=right colspan=5><INPUT NAME="display" TYPE="Text" SIZE=24 VALUE="0" WIDTH=100%></TD>
</TR>
<TR>
<TD align=center><INPUT type=button name="seven" value=" 7 "></TD>
<TD align=center><INPUT type=button name="eight" value=" 8 "></TD>
<TD align=center><INPUT type=button name="nine" value=" 9"></TD>
<TD align=center><INPUT type=button name="clear" value=" C "></TD>
<TD align=center><INPUT type=button name="back" value=" <- "></TD>
</TR>
<TR>
<TD align=center><INPUT type=button name="four" value=" 4 "></TD>
<TD align=center><INPUT type=button name="five" value=" 5 "></TD>
<TD align=center><INPUT type=button name="six" value=" 6"></TD>
<TD align=center><INPUT type=button name="multiply" value=" *"></TD>
<TD align=center><INPUT type=button name="divide" value="÷"></TD>
</TR>
<TR>
<TD align=center><INPUT type=button name="one" value=" 1 "></TD>
<TD align=center><INPUT type=button name="two" value=" 2 "></TD>
<TD align=center><INPUT type=button name="three" value=" 3"></TD>
<TD align=center><INPUT type=button name="plus" value=" + "></TD>
<TD align=center><INPUT type=button name="minus" value="-"></TD>
</TR>
<TR>
<TD align=center><INPUT type=button name="zero" value=" 0 "></TD>
<TD align=center><INPUT type=button name="point" value=" ."></TD>
<TD align=center><INPUT type=button name="pi" value=" pi "></TD>
<TD align=center><INPUT type=button name="plusminus" value=" +/- "></TD>
<TD align=center><INPUT type=button name="equals" value="=" onClick="equals()"></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<br>
<br>
By Dazfish
<% 'I am known as Dazfish or Goldfish
' Email -> Dazfish123@aol.com
' Website -> http://members.aol.com/Dazfish123
%>
</font>
</CENTER>
</BODY>
</HTML>