<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>
| 欢迎光临 站长论坛 (https://tzlink.com/bbs/) | Powered by Discuz! X3.2 |