PHP编写网页BS结构计算器
php代码
<html> <head> <title>caculator</title> </head> <body> <form name="myform" method="POST"> <tr> <script language = "javascript"> </script> <td><input type="text" name="text1"/></td><br/> <td><input type="text" name="sign" value="+"/<?$_GET['add']?></td><br/> <td><input type="text" name="text2"/></td><br/> <td><input type="text" name="text3"/></td><br/> <td><input type="button" name="count" value="="/></td><br/> <td><input type="text" name="equals"/></td><br/> <td><input type="reset" name="reset"/></td><br/> </tr> <tr> <script language = "javascript"> function count(text3){ var text1 = parseint(document.form.text1.value); var text2 = parseint(document.form.text2.value); } switch(text3){ case 0: document.form.text3.value = text1 + text2; break; case 1: document.form.text3.value = text1 - text2; break; case 2: document.form.text3.value = text1 * text2; break; case 3: document.form.text3.value = text1 / text2; break; default(text3 = text1/text2!=0){ document.form.text3.value = text1/text2; } } </script> <td><input type="text" name="text1"/></td><br/> <td><input type="text" name="sign" value="-"/><?$_GET['sub']?></td><br/> <td><input type="text" name="text2"/></td><br/> <td><input type="text" name="text3"/></td><br/> <td><input type="button" name="count" value="="/></td><br/> <td><input type="text" name="equals"/></td><br/> <td><input type="reset" name="reset"/></td><br/> </tr> <tr> <script language = "javascript"> </script> <td><input type="text" name="text1"/></td><br/> <td><input type="text" name="sign" value="*"/><?$_GET['mul']?></td><br/> <td><input type="text" name="text2"/></td><br/> <td><input type="text" name="text3"/></td><br/> <td><input type="button" name="count" value="="/></td><br/> <td><input type="text" name="equals"/></td><br/> <td><input type="reset" name="reset"/></td><br/> </tr> <tr> <script language = "javascript"> </script> <td><input type="text" name="text1"/></td><br/> <td><input type="text" name="sign" value="/"/><?$_GET['p']?></td><br/> <td><input type="text" name="text2"/></td><br/> <td><input type="text" name="text3"/></td><br/> <td><input type="button" name="count" value="="/></td><br/> <td><input type="text" name="equals"/></td><br/> <td><input type="reset" name="reset"/></td><br/> </tr> </form> <?php class calculate{ pbulic $text1; public $text2; public $text3; function add($text1,$text2){ $text3 = $text1 + $text2; $this->text1=$text1; $this->text2=$text2; echo "$_GET[add]"; } function sub($text1,$text2){ $text3 = $text1 - $text2; $this->text1=$text1; $this->text2=$text2; echo "$_GET[sub]"; } function mul($text1,$text2){ $text3 = $text1 * $text2; $this->text1=$text1; $this->text2=$text2; echo "$_GET[mul]"; } function p($text1,$text2){ $text3 = $text1 / $text2; $this->text1=$text1; $this->text2=$text2; echo "$_GET[p]"; } function getresult(){ echo $text3 = ($text1 + $text2). ".$_GET[add]"; echo $text3 = ($text1 + $text2). ".$_GET[sub]"; echo $text3 = ($text1 + $text2). ".$_GET[mul]"; echo $text3 = ($text1 + $text2). ".$_GET[p]"; } } ?> </body> </html>
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
如何修復KB5055523無法在Windows 11中安裝?
3 週前
By DDD
如何修復KB5055518無法在Windows 10中安裝?
3 週前
By DDD
<🎜>:死鐵路 - 如何馴服狼
4 週前
By DDD
<🎜>:種植花園 - 完整的突變指南
2 週前
By DDD
R.E.P.O.的每個敵人和怪物的力量水平
4 週前
By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)