• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

html taschenrechnerprogrammierung ein paar fragen

hab grad nochn Fehler gefunden:
Code:
(pEingabe.search(/\./) != -1 &[B]&[/B] pEingabe.search(/\d+\./) == -1) ||
Da hat ein zweites & gefehlt
 
Werbung:
Code:
if(pEingabe.search(/\b\d+\.?\d+\b/) == -1 ||
  (pEingabe.search(/\./) != -1 & pEingabe.search(/\d+\./) == -1) ||
   pEingabe.search(/[0-9]+\.|[1-9]/) == -1)
{
   alert("Fehler");
   return false;
}

Wenn du hier noch alert("Fehler") reinmachst, kommt dann nen alert-Dialog?
 
Werbung:
Und wenn du es vor die if-Anweisung machst?

edit: mir is nochwas aufgefallen:
Code:
[B]//[/B]function Check (pEingabe) {
Die Kommentarzeichen
 
Hab grad festgestellt, dass nur

(pEingabe.search(/\./) != -1 && pEingabe.search(/\d+\./) == -1)

funktioniert, die anderen beiden nicht :oops:
 
Werbung:
die kommentarzeichen hatte ich schon enfernt das war der fehler heut nachmittag
vor der if anweisung funktioniert aber auch nicht
 
Hab außerdem noch festgestellt, das onchange rest aufgerufen wird, nachdem man das eingabefeld verlassen hat. mach aus "onchange" "onkeypress"

edit: die Sache mit dem keine 0 außer wenn punkt hab ich abgeändert:
(pEingabe.search(/\b[0]/) == -1 && pEingabe.search(/[.]/) == -1)
allerdings würde ich die erst vorm rechnen überprüfen, da wenn man als erstes eine 0 eintippt ja kein Komma dasteht und der browser nicht weiß was der Client als nächstes eingibt.
 
habs in onkeypress geändert und nur: (pEingabe.search(/\./) != -1 && pEingabe.search(/\d+\./) == -1) verwendet aber ich kann immer noch .1 eintippen und er akzeptiert es
 
Werbung:
Habs jetzt noch ma von vorne angefangen und siehe da:

HTML:
<html>
<head>
<title>JavaScript Parameter 28.02.2011</title>
</head>
<script type="text/javascript">
function Check (pEingabe) {
  var nur_das = "0123456789[]()-+*%/.";
  for (var i = 0; i < pEingabe.length; i++)
  {
    if (nur_das.indexOf(pEingabe.charAt(i)) < 0)
      return false;
  }
  if(pEingabe[0] == "." ||
     pEingabe.search(/[0-9]\.[0-9]?\./) != -1)
  {
    return false;
  }
  else return true;
}

var vOp = "";
function schreibeZahl(pEingabe){

document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value + pEingabe;
}
function loesche() {
document.Formular.Ausgabe.value= "";
}
function zurück() {
vKette = document.formular.Ausgabe.value;
vL = vKette.length;
vKette = vKette.substring(0,vL-1);
document.formular.Ausgabe.value = vKette;
}
function rechne(pOperator){
document.Formular.ergebnisZahl1.value = document.Formular.schreibeZahl1.value;
document.Formular.schreibeZahl1.value = "";
vOp = pOperator;
}

function rechneErg(){
vRechnung = document.Formular.ergebnisZahl1.value + vOp + document.Formular.schreibeZahl1.value
vErg = eval(vRechnung);

document.Formular.ergebnisZahl1.value = vErg ;
document.Formular.schreibeZahl1.value = vRechnung ;

vOp = "";
}
function wurzel(){
vErg=Math.sqrt(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function sinus(){
vErg=Math.sin(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function cosinus(){
vErg=Math.cos(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function tangens(){
vErg=Math.tan(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}

</script>
<body>
<form name="Formular" action="">
<table border=4>
<tr>
<td><Input type="text" name="ergebnisZahl1" size="14" value="" onClick="schreibeZahl(Zeichen);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" AC " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="text" name="schreibeZahl1" size="14" maxlength="12" value="" onClick="schreibeZahl(pEingabe);" onkeypress="if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" C " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" sin " onClick="sinus('sin');"> </td>
<td><Input type="button" size="15" value=" cos " onClick="cosinus('cos');"> </td>
<td><Input type="button" size="15" value=" tan " onClick="tangens('tan');"> </td>
<td><Input type="button" size="15" value=" wur " onClick="wurzel('wur');"> </td>
</tr>
<tr>

<td><Input type="button" size="15" value=" 7 " onClick="schreibeZahl('7');"> </td>
<td><Input type="button" size="15" value=" 8 " onClick="schreibeZahl('8');"> </td>
<td><Input type="button" size="15" value=" 9 " onClick="schreibeZahl('9');"> </td>
<td><Input type="button" size="15" value=" / " onClick="rechne('/');"> </td>

</tr>
<tr>
<td><Input type="button" size="15" value=" 4 " onClick="schreibeZahl('4');"> </td>
<td><Input type="button" size="15" value=" 5 " onClick="schreibeZahl('5');"> </td>
<td><Input type="button" size="15" value=" 6 " onClick="schreibeZahl('6');"> </td>

<td><Input type="button" size="15" value=" * " onClick="rechne('*');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 1 " onClick="schreibeZahl('1');"> </td>
<td><Input type="button" size="15" value=" 2 " onClick="schreibeZahl('2');"> </td>
<td><Input type="button" size="15" value=" 3 " onClick="schreibeZahl('3');"> </td>

<td><Input type="button" size="15" value=" - " onClick="rechne('-');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 0 " onClick="schreibeZahl('0');"> </td>
<td><Input type="button" size="15" value=" , " onClick="schreibeZahl('.');"> </td>
<td><Input type="button" size="15" value=" +/- " onClick="schreibeZahl('-');"> </td>
<td><Input type="button" size="15" value=" + " onClick="rechne('+');"> </td>
</tr>
<tr>
<td colspan="4"><Input type="button" style="width:405px;height:20px;" value=" = " onClick="rechneErg('=');"> </td>
</table>
</form>
</body>
</html>

Das mit dem am Anfang keine Null außer wenn danach Komma kommt dann demnächst.
 
Und die Überprüfung, ob am Anfang eine Null steht...
Code:
if((document.Formular.schreibeZahl1.value[0] != "0") || (document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
 
Werbung:
so richtig? denn ich kann immernoch alles machen, mehr als einen punkt; null am anfang und führende null


function Check (pEingabe) {
var nur_das = "0123456789[]()-+*%/.";
for (var i = 0; i < pEingabe.length; i++)
{
if (nur_das.indexOf(pEingabe.charAt(i)) < 0)
return false;
}
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9]?\./) != -1)
if((document.Formular.schreibeZahl1.value[0] != "0") || (document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
return false;
}
else return true;
}
 
if((document.Formular.schreibeZahl1.value[0] != "0") || (document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
Diesen Teil musst / kannst du erst überprüfen, wennein Rechenoperator ausgeführt wird,
Also z.B.

Code:
[COLOR=#000080]function rechne(pOperator){
[/COLOR]  if((document.Formular.schreibeZahl1.value[0] != "0") || 
  {
     (document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
[COLOR=#000080]    document.Formular.ergebnisZahl1.value = document.Formular.schreibeZahl1.value;
    document.Formular.schreibeZahl1.value = "";
    vOp = pOperator;
  }
}



Und hab noch gemerkt, dass du nicht nur bei der Direkteingabe Check() aufrufen musst, sondern auch beim klick auf die "."-Taste:
Code:
[/COLOR][COLOR=#008080][/COLOR][COLOR=#FF8000]<Input type=[COLOR=#0000FF]"button"[/COLOR] size=[COLOR=#0000FF]"15"[/COLOR] value=[COLOR=#0000FF]" , "[/COLOR] onClick=[COLOR=#0000FF]"schreibeZahl('.'); [/COLOR][/COLOR][COLOR=#FF8000][COLOR=#0000FF]if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);[/COLOR][/COLOR]" >
 
habs geändert nur jetzt kann man wieder über die buttons keine eingabe machen... hmm

<html>
<head>
<title>JavaScript Parameter 28.02.2011</title>
</head>
<script type="text/javascript">
function Check (pEingabe) {
var nur_das = "0123456789[]()-+*%/.";
for (var i = 0; i < pEingabe.length; i++)
{
if (nur_das.indexOf(pEingabe.charAt(i)) < 0)
return false;
}
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9]?\./) != -1)
{
return false;
}
else return true;
}
var vOp = "";
function schreibeZahl(pEingabe){
document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value + pEingabe;
}
function loesche() {
document.Formular.Ausgabe.value= "";
}
function zurück() {
vKette = document.formular.Ausgabe.value;
vL = vKette.length;
vKette = vKette.substring(0,vL-1);
document.formular.Ausgabe.value = vKette;
}
function rechne(pOperator){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
{
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
document.Formular.ergebnisZahl1.value = document.Formular.schreibeZahl1.value;
document.Formular.schreibeZahl1.value = "";
vOp = pOperator;
}
}
function rechneErg(){
vRechnung = document.Formular.ergebnisZahl1.value + vOp + document.Formular.schreibeZahl1.value
vErg = eval(vRechnung);
document.Formular.ergebnisZahl1.value = vErg ;
document.Formular.schreibeZahl1.value = vRechnung ;
vOp = "";
}
function wurzel(){
vErg=Math.sqrt(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function sinus(){
vErg=Math.sin(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function cosinus(){
vErg=Math.cos(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function tangens(){
vErg=Math.tan(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
</script>
<body>
<form name="Formular" action="">
<table border=4>
<tr>
<td><Input type="text" name="ergebnisZahl1" size="14" value="" onClick="schreibeZahl(Zeichen);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" AC " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="text" name="schreibeZahl1" size="14" maxlength="12" value="" onClick="schreibeZahl(pEingabe);" onkeypress="if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" C " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" sin " onClick="sinus('sin');"> </td>
<td><Input type="button" size="15" value=" cos " onClick="cosinus('cos');"> </td>
<td><Input type="button" size="15" value=" tan " onClick="tangens('tan');"> </td>
<td><Input type="button" size="15" value=" wur " onClick="wurzel('wur');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 7 " onClick="schreibeZahl('7');"> </td>
<td><Input type="button" size="15" value=" 8 " onClick="schreibeZahl('8');"> </td>
<td><Input type="button" size="15" value=" 9 " onClick="schreibeZahl('9');"> </td>
<td><Input type="button" size="15" value=" / " onClick="rechne('/');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 4 " onClick="schreibeZahl('4');"> </td>
<td><Input type="button" size="15" value=" 5 " onClick="schreibeZahl('5');"> </td>
<td><Input type="button" size="15" value=" 6 " onClick="schreibeZahl('6');"> </td>
<td><Input type="button" size="15" value=" * " onClick="rechne('*');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 1 " onClick="schreibeZahl('1');"> </td>
<td><Input type="button" size="15" value=" 2 " onClick="schreibeZahl('2');"> </td>
<td><Input type="button" size="15" value=" 3 " onClick="schreibeZahl('3');"> </td>
<td><Input type="button" size="15" value=" - " onClick="rechne('-');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 0 " onClick="schreibeZahl('0');"> </td>
<td><Input type="button" size="15" value=" , " onClick="schreibeZahl('.'); if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);" >
<td><Input type="button" size="15" value=" +/- " onClick="schreibeZahl('-');"> </td>
<td><Input type="button" size="15" value=" + " onClick="rechne('+');"> </td>
</tr>
<tr>
<td colspan="4"><Input type="button" style="width:405px;height:20px;" value=" = " onClick="rechneErg('=');"> </td>
</table>
</form>
</body>
</html>
 
Werbung:
if((document.Formular.schreibeZahl1.value[0] != "0") ||
{
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
Die Klammer ist an der Falschen Stelle und hat somit einen Fehler ausgelöst. So ist es richtig.
Code:
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
Code:
if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);
Da hab ich einfach nicht nachgedacht und den Code einfach kopiert. Es müsste das "this.value" durch "document.Formular.schreibeZahl1.value" ausgetauscht werden:
Code:
if(!Check(document.Formular.schreibeZahl1.value)) document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value.substr(0,document.Formular.schreibeZahl1.value.length-1);
edit: noch eine kleine Änderung
Code:
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9][i][B]?[/i][/B]\./) != -1)
zu

Code:
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9][i][B]{0,}[/i][/B]\./) != -1)
 
Zuletzt bearbeitet:
onkeypress=="if(!Check(document.Formular.schreibeZahl1.value)) this.value=this.value.substr(0,this.value.length-1);"> </td>

ist der befehl so richtig?
 
ich kann immernoch alles eingeben :(


<html>
<head>
<title>JavaScript Parameter 28.02.2011</title>
</head>
<script type="text/javascript">
function Check (pEingabe) {
var nur_das = "0123456789[]()-+*%/.";
for (var i = 0; i < pEingabe.length; i++)
{
if (nur_das.indexOf(pEingabe.charAt(i)) < 0)
return false;
}
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9]{0,}\./) != -1)
{
return false;
}
else return true;
}
var vOp = "";
function schreibeZahl(pEingabe){
document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value + pEingabe;
}
function loesche() {
document.Formular.Ausgabe.value= "";
}
function zurück() {
vKette = document.formular.Ausgabe.value;
vL = vKette.length;
vKette = vKette.substring(0,vL-1);
document.formular.Ausgabe.value = vKette;
}
function rechne(pOperator){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
document.Formular.ergebnisZahl1.value = document.Formular.schreibeZahl1.value;
document.Formular.schreibeZahl1.value = "";
vOp = pOperator;
}
}
function rechneErg(){
vRechnung = document.Formular.ergebnisZahl1.value + vOp + document.Formular.schreibeZahl1.value
vErg = eval(vRechnung);
document.Formular.ergebnisZahl1.value = vErg ;
document.Formular.schreibeZahl1.value = vRechnung ;
vOp = "";
}
function wurzel(){
vErg=Math.sqrt(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function sinus(){
vErg=Math.sin(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function cosinus(){
vErg=Math.cos(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
function tangens(){
vErg=Math.tan(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
</script>
<body>
<form name="Formular" action="">
<table border=4>
<tr>
<td><Input type="text" name="ergebnisZahl1" size="14" value="" onClick="schreibeZahl(Zeichen);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" AC " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="text" name="schreibeZahl1" size="14" maxlength="12" value="" onClick="schreibeZahl(pEingabe);" onkeypress=="if(!Check(document.Formular.schreibeZahl1.value)) this.value=this.value.substr(0,this.value.length-1);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" C " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" sin " onClick="sinus('sin');"> </td>
<td><Input type="button" size="15" value=" cos " onClick="cosinus('cos');"> </td>
<td><Input type="button" size="15" value=" tan " onClick="tangens('tan');"> </td>
<td><Input type="button" size="15" value=" wur " onClick="wurzel('wur');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 7 " onClick="schreibeZahl('7');"> </td>
<td><Input type="button" size="15" value=" 8 " onClick="schreibeZahl('8');"> </td>
<td><Input type="button" size="15" value=" 9 " onClick="schreibeZahl('9');"> </td>
<td><Input type="button" size="15" value=" / " onClick="rechne('/');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 4 " onClick="schreibeZahl('4');"> </td>
<td><Input type="button" size="15" value=" 5 " onClick="schreibeZahl('5');"> </td>
<td><Input type="button" size="15" value=" 6 " onClick="schreibeZahl('6');"> </td>
<td><Input type="button" size="15" value=" * " onClick="rechne('*');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 1 " onClick="schreibeZahl('1');"> </td>
<td><Input type="button" size="15" value=" 2 " onClick="schreibeZahl('2');"> </td>
<td><Input type="button" size="15" value=" 3 " onClick="schreibeZahl('3');"> </td>
<td><Input type="button" size="15" value=" - " onClick="rechne('-');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 0 " onClick="schreibeZahl('0');"> </td>
<td><Input type="button" size="15" value=" , " onClick="schreibeZahl('.'); if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);" >
<td><Input type="button" size="15" value=" +/- " onClick="schreibeZahl('-');"> </td>
<td><Input type="button" size="15" value=" + " onClick="rechne('+');"> </td>
</tr>
<tr>
<td colspan="4"><Input type="button" style="width:405px;height:20px;" value=" = " onClick="rechneErg('=');"> </td>
</table>
</form>
</body>
</html>
 
Werbung:
Hatte mich falsch ausgedrückt. Meinte die Änderung von this.value nicht bei dem text-Feld, sondern bei deem Punkt-Button.
Der gesamte Code sieht dann so aus:

HTML:
<html>
<head>
<title>JavaScript Parameter 28.02.2011</title>
</head>
<script type="text/javascript">
function Check (pEingabe) {
var nur_das = "0123456789[]()-+*%/.";
for (var i = 0; i < pEingabe.length; i++)
{
if (nur_das.indexOf(pEingabe.charAt(i)) < 0)
return false;
}
if(pEingabe[0] == "." ||
pEingabe.search(/[0-9]\.[0-9]{0,}\./) != -1)
{
return false;
}
else return true;
}
var vOp = "";
function schreibeZahl(pEingabe){
document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value + pEingabe;
}
function loesche() {
document.Formular.Ausgabe.value= "";
}
function zurück() {
vKette = document.formular.Ausgabe.value;
vL = vKette.length;
vKette = vKette.substring(0,vL-1);
document.formular.Ausgabe.value = vKette;
}
function rechne(pOperator){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
document.Formular.ergebnisZahl1.value = document.Formular.schreibeZahl1.value;
document.Formular.schreibeZahl1.value = "";
vOp = pOperator;
}
}
function rechneErg(){
vRechnung = document.Formular.ergebnisZahl1.value + vOp + document.Formular.schreibeZahl1.value
vErg = eval(vRechnung);
document.Formular.ergebnisZahl1.value = vErg ;
document.Formular.schreibeZahl1.value = vRechnung ;
vOp = "";
}
function wurzel(){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
vErg=Math.sqrt(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
}
function sinus(){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
vErg=Math.sin(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
}
function cosinus(){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
vErg=Math.cos(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
}
function tangens(){
if((document.Formular.schreibeZahl1.value[0] != "0") ||
(document.Formular.schreibeZahl1.value[0] == "0" && document.Formular.schreibeZahl1.value.search(/\./) != -1))
{
vErg=Math.tan(document.Formular.schreibeZahl1.value);
document.Formular.ergebnisZahl1.value = vErg;
}
}
</script>
<body>
<form name="Formular" action="">
<table border=4>
<tr>
<td><Input type="text" name="ergebnisZahl1" size="14" value="" onClick="schreibeZahl(Zeichen);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" AC " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="text" name="schreibeZahl1" size="14" maxlength="12" value="" onClick="schreibeZahl(pEingabe);" onkeypress="if(!Check(this.value)) this.value=this.value.substr(0,this.value.length-1);"> </td>
<td colspan="3"><Input type="reset" style="width:300px;height:20px;" value=" C " onClick="schreibeZahl();"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" sin " onClick="sinus('sin');"> </td>
<td><Input type="button" size="15" value=" cos " onClick="cosinus('cos');"> </td>
<td><Input type="button" size="15" value=" tan " onClick="tangens('tan');"> </td>
<td><Input type="button" size="15" value=" wur " onClick="wurzel('wur');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 7 " onClick="schreibeZahl('7');"> </td>
<td><Input type="button" size="15" value=" 8 " onClick="schreibeZahl('8');"> </td>
<td><Input type="button" size="15" value=" 9 " onClick="schreibeZahl('9');"> </td>
<td><Input type="button" size="15" value=" / " onClick="rechne('/');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 4 " onClick="schreibeZahl('4');"> </td>
<td><Input type="button" size="15" value=" 5 " onClick="schreibeZahl('5');"> </td>
<td><Input type="button" size="15" value=" 6 " onClick="schreibeZahl('6');"> </td>
<td><Input type="button" size="15" value=" * " onClick="rechne('*');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 1 " onClick="schreibeZahl('1');"> </td>
<td><Input type="button" size="15" value=" 2 " onClick="schreibeZahl('2');"> </td>
<td><Input type="button" size="15" value=" 3 " onClick="schreibeZahl('3');"> </td>
<td><Input type="button" size="15" value=" - " onClick="rechne('-');"> </td>
</tr>
<tr>
<td><Input type="button" size="15" value=" 0 " onClick="schreibeZahl('0');"> </td>
<td><Input type="button" size="15" value=" , " onClick="schreibeZahl('.'); if(!Check(document.Formular.schreibeZahl1.value)) document.Formular.schreibeZahl1.value=document.Formular.schreibeZahl1.value.substr(0,document.Formular.schreibeZahl1.value.length-1);" >
<td><Input type="button" size="15" value=" +/- " onClick="schreibeZahl('-');"> </td>
<td><Input type="button" size="15" value=" + " onClick="rechne('+');"> </td>
</tr>
<tr>
<td colspan="4"><Input type="button" style="width:405px;height:20px;" value=" = " onClick="rechneErg('=');"> </td>
</table>
</form>
</body>
</html>
 
Zurück
Oben