Advertisement
Guest User

Taschenrechner

a guest
Oct 29th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.11 KB | None | 0 0
  1. <HTML>
  2. <HEAD>
  3.     <TITLE>Taschenrechner</TITLE>
  4.  
  5.     <HTA:APPLICATION
  6.      APPLICATIONNAME="Taschenrechner"
  7.      SINGLEINSTANCE="Yes"
  8.      WINDOWSTATE="normal"
  9.      BORDER="yes"
  10.      MAXIMIZE="yes"
  11.      CAPTION="Funktions-Demo: Ausgabe in Fenster"
  12.      SHOWINTASKBAR="yes"
  13.      SYSMENU="yes">
  14.  
  15.     <SCRIPT LANGUAGE="VBScript">
  16.  
  17.         Option Explicit
  18.  
  19.         Sub Voreinstellungen()
  20.             ' Fenstergröße festlegen
  21.             Window.resizeTo 540, 500
  22.         End Sub
  23.  
  24.         Public Sub NummernTaste(Number)
  25.                 Select Case Formular.txtOperator.Value
  26.                 Case 0
  27.                     If Formular.txtDisplay.Value = "0" Then
  28.                         Formular.txtDisplay.Value = Number
  29.                     Else
  30.                         Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number                                                        
  31.                     End If
  32.                 Case 8
  33.                     Formular.txtDisplay.Value = ""
  34.                     Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number 
  35.                     Formular.txtOperator.Value = 1
  36.                 Case 9
  37.                     Formular.txtDisplay.Value = ""
  38.                     Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number 
  39.                     Formular.txtOperator.Value = 2
  40.                 Case 10
  41.                     Formular.txtDisplay.Value = ""
  42.                     Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number 
  43.                     Formular.txtOperator.Value = 3
  44.                 Case 11
  45.                     Formular.txtDisplay.Value = ""
  46.                     Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number 
  47.                     Formular.txtOperator.Value = 4
  48.  
  49.                 Case Else
  50.                     Formular.txtDisplay.Value = Formular.txtDisplay.Value & Number
  51.                 End Select
  52.            
  53.         End Sub
  54.  
  55.         Public Sub KommaTaste()
  56.             If Instr(1,Formular.txtDisplay.Value,",") Then
  57.                     If Formular.txtOperator.Value > 7 Then
  58.                                        Formular.txtDisplay.Value = ","
  59.                                        Formular.txtOperator.Value = Formular.txtOperator.Value - 7
  60.                                End If
  61.                        Else
  62.                 Formular.txtDisplay.Value = Formular.txtDisplay.Value & ","
  63.             End If
  64.         End Sub
  65.  
  66.         Public Sub OperatorTaste(Number)
  67.             On Error Resume Next
  68.                        Select Case Number
  69.             Case 1
  70.                 Formular.txtValue.Value = Formular.txtDisplay.Value
  71.                 Formular.txtOperator.Value = 8
  72.             Case 2
  73.                 Formular.txtValue.Value = Formular.txtDisplay.Value
  74.                 Formular.txtOperator.Value = 9
  75.             Case 3
  76.                 Formular.txtValue.Value = Formular.txtDisplay.Value
  77.                 Formular.txtOperator.Value = 10
  78.             Case 4
  79.                 Formular.txtValue.Value = Formular.txtDisplay.Value
  80.                 Formular.txtOperator.Value = 11
  81.             Case 5
  82.                                If Left(Formular.txtDisplay.Value,1) = "-" Then
  83.                                         Formular.txtDisplay.Value = Right(Formular.txtDisplay.Value,Len(Formular.txtDisplay.Value)-1)
  84.                                Else
  85.                                         Formular.txtDisplay.Value = "-" & Formular.txtDisplay.Value
  86.                                End If
  87.             Case 6
  88.                 'c
  89.                 Formular.txtDisplay.Value = ""
  90.                 Formular.txtValue.Value = 0
  91.                 Formular.txtOperator.Value = 0
  92.             Case 7
  93.                 '=
  94.                 Select Case Formular.txtOperator.Value
  95.                 Case 1
  96.                     Formular.txtDisplay.Value = cDbl(Formular.txtDisplay.Value) + cDbl(Formular.txtValue.Value)
  97.                 Case 2
  98.                     Formular.txtDisplay.Value = cDbl(Formular.txtValue.Value) - cDbl(Formular.txtDisplay.Value)
  99.                 Case 3
  100.                     Formular.txtDisplay.Value = cDbl(Formular.txtValue.Value) * cDbl(Formular.txtDisplay.Value)
  101.                 Case 4
  102.                     Formular.txtDisplay.Value = cDbl(Formular.txtValue.Value) / cDbl(Formular.txtDisplay.Value)
  103.                 Case Else
  104.                     Formular.txtDisplay.Value = Formular.txtValue.Value
  105.                 End Select
  106.  
  107.             case Else
  108.             End Select
  109.         End Sub
  110.  
  111.     </SCRIPT>
  112.  
  113.     <STYLE TYPE="text/css">
  114.         H1, H2, H3       { font-family:Arial,Helvetica,sans-serif;color:lime;margin-top:12pt;margin-bottom:12pt}
  115.         UL               { list-style-type:circle }
  116.         UL,OL,LI,P       { margin-top:3pt;font-family:Verdana,Arial,Helvetica,sans-serif }
  117.         TD,TH            { margin-top:0pt}
  118.         TH               { background-color:#CECECE;font-size:9pt;font-weight:bold;line-height:11pt }
  119.         BODY,P,DD,DL,DT  { font-family:Verdana,Arial,Helvetica,sans-serif;color:lime;font-size:9pt;margin-top:3pt;margin-bottom:3pt }
  120.         BODY             { background:url("./hintergrund.gif")}
  121.         A:LINK           { color:blue }
  122.         A:VISITED        { color:red }
  123.         A:ACTIVE         { color:darkred }
  124.         BLOCKQUOTE, TD   { color:navy }
  125.         B.Trenner        { font-family:Arial,Helvetica,sans-serif;color:gray;font-size:16pt }
  126.         .Marker          { background-color:#FFFF80;font-weight:bold }
  127.         INPUT        { font-family: Arial, Helvetica, sans-serif;font-size: 13px;font-weight: bold;background-color: gray;color : Lime;border : 1 solid  #CCCCCC; }
  128.     </STYLE>
  129. </HEAD>
  130.  
  131. <BODY ONLOAD="Voreinstellungen" STYLE="background-color:#101010">
  132.  
  133. <H1>Taschenrechner</H1>
  134.  
  135. <P>Dieses Beispiel stellt einen Kleinen Taschenrechner dar, es können die Grundrechnungsarten angewendet werden.</P>
  136. <HR NOSHADE>
  137. <FORM NAME="Formular" METHOD="Post" ENCTYPE="multipart/form-data">
  138.     <TABLE BORDER="0" CELLPADDING="5" CELLSPACING="1" STYLE="width:450px;margin-top:50px">
  139.         <TR VALIGN="TOP">
  140.             <TD>
  141.     <p>
  142. <INPUT TYPE="TEXT" NAME="txtDisplay" VALUE="" STYLE="width:139px" readonly>
  143. <INPUT TYPE="HIDDEN" NAME="txtValue" VALUE="0" STYLE="width:20px">
  144. <INPUT TYPE="HIDDEN" NAME="txtOperator" VALUE="0" STYLE="width:20px">
  145.     </p>
  146. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="+" ONCLICK="OperatorTaste(1)" STYLE="width:30px">
  147. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="7" ONCLICK="NummernTaste(7)" STYLE="width:30px">
  148. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="8" ONCLICK="NummernTaste(8)" STYLE="width:30px">
  149. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="9" ONCLICK="NummernTaste(9)" STYLE="width:30px">
  150. <br>
  151. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="-" ONCLICK="OperatorTaste(2)" STYLE="width:30px">
  152. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="4" ONCLICK="NummernTaste(4)" STYLE="width:30px">
  153. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="5" ONCLICK="NummernTaste(5)" STYLE="width:30px">
  154. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="6" ONCLICK="NummernTaste(6)" STYLE="width:30px">
  155. <br>
  156. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="*" ONCLICK="OperatorTaste(3)" STYLE="width:30px">
  157. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="1" ONCLICK="NummernTaste(1)" STYLE="width:30px">
  158. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="2" ONCLICK="NummernTaste(2)" STYLE="width:30px">
  159. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="3" ONCLICK="NummernTaste(3)" STYLE="width:30px">
  160. <br>
  161. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="/" ONCLICK="OperatorTaste(4)" STYLE="width:30px">
  162. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="+/-" ONCLICK="OperatorTaste(5)" STYLE="width:30px">
  163. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="0" ONCLICK="NummernTaste(0)" STYLE="width:30px">
  164. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="," ONCLICK="KommaTaste()" STYLE="width:30px">
  165.             </TD>
  166.         </TR>
  167.         <TR VALIGN="TOP">
  168.             <TD>
  169. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="C" ONCLICK="OperatorTaste(6)" STYLE="width:66px">
  170. <INPUT TYPE="BUTTON" NAME="Ausgabe" VALUE="=" ONCLICK="OperatorTaste(7)" STYLE="width:66px">
  171.             </TD>
  172.         </TR>
  173.     </TABLE>
  174. </FORM>
  175.     <P><HR></P>
  176.  
  177.     <P ALIGN=CENTER>Stand:  03.08.2009 - Bitte alle Probleme melden!</P>
  178. </BODY>
  179. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement