Autor Zpráva
Johnny83
Profil
Ahoj, nevíte o nějakém programu co to umí? Nebo nemohl by jste mi někdo ten script napsat v php?
<FORM NAME="Calc">
 <TABLE BORDER=4> 
 <TR> <TD> 
 <INPUT TYPE="text"   NAME="Input" Size="16">
  <br> 
  </TD> </TR>
  <TR> <TD> 
   <INPUT TYPE="button" NAME="one"   VALUE="  1  " OnClick="Calc.Input.value += '1'">
    <INPUT TYPE="button" NAME="two"   VALUE="  2  " OnCLick="Calc.Input.value += '2'">
     <INPUT TYPE="button" NAME="three" VALUE="  3  " OnClick="Calc.Input.value += '3'">
      <INPUT TYPE="button" NAME="plus"  VALUE="  +  " OnClick="Calc.Input.value += ' + '"> 
  <br> 
      <INPUT TYPE="button" NAME="four"  VALUE="  4  " OnClick="Calc.Input.value += '4'">
       <INPUT TYPE="button" NAME="five"  VALUE="  5  " OnCLick="Calc.Input.value += '5'"> 
       <INPUT TYPE="button" NAME="six"   VALUE="  6  " OnClick="Calc.Input.value += '6'"> 
       <INPUT TYPE="button" NAME="minus" VALUE="  -  " OnClick="Calc.Input.value += ' - '">
        <br>
         <INPUT TYPE="button" NAME="seven" VALUE="  7  " OnClick="Calc.Input.value += '7'">
          <INPUT TYPE="button" NAME="eight" VALUE="  8  " OnCLick="Calc.Input.value += '8'">
           <INPUT TYPE="button" NAME="nine"  VALUE="  9  " OnClick="Calc.Input.value += '9'">
            <INPUT TYPE="button" NAME="times" VALUE="  x  " OnClick="Calc.Input.value += ' * '">
             <br>
              <INPUT TYPE="button" NAME="clear" VALUE="  c  " OnClick="Calc.Input.value = ''">
               <INPUT TYPE="button" NAME="zero"  VALUE="  0  " OnClick="Calc.Input.value += '0'">
                <INPUT TYPE="button" NAME="DoIt"  VALUE="  =  " OnClick="Calc.Input.value = eval(Calc.Input.value)">
                 <INPUT TYPE="button" NAME="div"   VALUE="  /  " OnClick="Calc.Input.value += ' / '">
   <br>
                   </TD> </TR>
                    </TABLE>
                     </FORM>
Keeehi
Profil
<?php
session_start();
if(!isset($_SESSION["vyraz"])) {
    $_SESSION["vyraz"]="";
}
?>

   <a href="?znak=1">1</a>
   <a href="?znak=2">2</a>
   <a href="?znak=3">3</a>
   <a href="?znak=p">+</a>
   <br>
   <a href="?znak=4">4</a>
   <a href="?znak=5">5</a>
   <a href="?znak=6">6</a>
   <a href="?znak=m">-</a>
   <br>
   <a href="?znak=7">7</a>
   <a href="?znak=8">8</a>
   <a href="?znak=9">9</a>
   <a href="?znak=t">*</a>
   <br>
   <a href="?znak=c">c</a>
   <a href="?znak=0">0</a>
   <a href="?znak=e">=</a>
   <a href="?znak=d">/</a>
   <br>
<?php
if(isset($_GET["znak"]) && in_array($_GET["znak"],array("1","2","3","4","5","6","7","8","9","p","m","t","d","c","0","e"))) {
    switch($_GET["znak"]) {
        case "p": $_SESSION["vyraz"] .= " + "; break;
        case "m": $_SESSION["vyraz"] .= " - "; break;
        case "t": $_SESSION["vyraz"] .= " * "; break;
        case "d": $_SESSION["vyraz"] .= " / "; break;
        case "c": $_SESSION["vyraz"] = ""; break;
        case "e": @eval(empty($_SESSION["vyraz"])?"":"\$i=".$_SESSION["vyraz"].";echo \$i;"); $_SESSION["vyraz"] = ""; break;
        default: $_SESSION["vyraz"] .= $_GET["znak"]; break;
    }
}
echo $_SESSION["vyraz"];
?>

1) je to ale docela prasárna
2) na takové věci je mnohem lepší ten javascript
Johnny83
Profil
Děkuju moc :-)

Vaše odpověď

Mohlo by se hodit

Odkud se sem odkazuje


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: