只需一步,快速开始
<html> <head> <title></title> <meta content="text/html charset=gb2312"> </head> <body> <?php $no1=$_GET['no1']; $no2=$_GET['no2']; $no3=$_GET['no3']; //global $num; $a = $_GET['1']; $a = $a.$_GET['2']; $a = $a.$_GET['3']; $a = $a.$_GET['4']; $a = $a.$_GET['5']; $a = $a.$_GET['6']; $a = $a.$_GET['7']; $a = $a.$_GET['8']; $a = $a.$_GET['9']; if((int)$a>0){ $num = $_GET['text']; if($no1=="="){ $num = 0; } $numa =(int)$num; if($numa==0){ $num = $a; }else{ $num = $num.$a; } } if($_GET['CE']=="CE"){ $num = 0; $no1 = 0; $no2 = 0; $no3 = 0; } //global $fuhao; $fuhao = $_GET['jia']; $fuhao = $fuhao.$_GET['jian']; $fuhao = $fuhao.$_GET['cheng']; $fuhao = $fuhao.$_GET['chu']; //global $num2; if($fuhao=='+'||$fuhao=='-'||$fuhao=='*'||$fuhao=='/'){ //global $fuhao1; $no3 = $fuhao; $no1 = $_GET['text']; $num = 0; } //global $num3; if($_GET['dengyu']=="="){ $num3 = $_GET['text']; $no1 = (double)$_GET['no1']; $no2 = (double)$num3; $no3 = $_GET['no3']; switch($no3){ case '+': $num = $no1 + $no2; break; case '-': $num = $no1 - $no2; break; case '*': $num = $no1 * $no2; break; case '/': $num = $no1 / $no2; break; } } ?> <form name="" action="" method="get"> <table bgcolor="blue" border="10" align="center"> <tr align="center"> <td colspan="4">计算器</td> </tr> <tr> <td colspan="4"><input type="text" name="text" readonly="true" align="right" value=<?php echo $num; ?> ></td> </tr> <tr> <td><input type="submit" name="1" value="1"></td> <td><input type="submit" name="2" value="2"></td> <td><input type="submit" name="3" value="3"></td> <td><input type="submit" name="jia" value="+"></td> </tr> <tr> <td><input type="submit" name="4" value="4"></td> <td><input type="submit" name="5" value="5"></td> <td><input type="submit" name="6" value="6"></td> <td><input type="submit" name="jian" value="-"></td> </tr> <tr> <td><input type="submit" name="7" value="7"></td> <td><input type="submit" name="8" value="8"></td> <td><input type="submit" name="9" value="9"></td> <td><input type="submit" name="cheng" value="*"></td> </tr> <tr> <td><input type="submit" name="CE" value="CE"></td> <td><input type="submit" name="0" value="0"></td> <td><input type="submit" name="dengyu" value="="></td> <td><input type="submit" name="chu" value="/"></td> </tr> <tr> <td><input type="hidden" name="no1" value=<?php echo $no1 ?> ></td> <td><input type="hidden" name="no2" value=<?php echo $no2 ?> ></td> <td><input type="hidden" name="no3" value=<?php echo $no3 ?> ></td> <td></td> </tr> </table> </form> </body> </html>
使用道具 举报
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
Hi,扫描关注我
小黑屋|手机版|Archiver|站长之家 ( 浙ICP备15045379号-1 )
Copyright © 2005-2026 站长论坛 All rights reserved
Powered by 站长论坛 with TZWEB Update Techonolgy Support