|
热门文章 |
|
|
|
相关文章 |
|
没有相关文章 |
|
|
根据房间面积和地砖长宽计算所需地砖数量的地砖计算器 |
来源:源码爱好者 更新时间:2010/10/14 9:58:09 阅读次数: 我要投稿 |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>地砖计算器 - 用多少地砖计输入面积即可以知道费用</title> </head> <body> <h3>地砖计算器</h3> <table height=202 cellspacing=0 cellpadding=0 width=285 align=center border=1> <form name=floorbrickfrm action="" method=post> <tbody> <tbody> <tr> <td colspan=3 height=26> <font color=#037ec5> <script language=JavaScript> <!-- <!-- 计算地砖公式主程序 --> function IsDigit(cCheck) { return ((('0'<=cCheck) && (cCheck<='9'))||cCheck=='.'); } function CheckNum(charValue,alertValue,obj) { for(var iIndex=0;iIndex<charValue.length;iIndex++) { var cCheck=charValue.charAt(iIndex); if(!IsDigit(cCheck)) { alert(alertValue); obj.focus(); return false; } } } function floor_brick(form) { //检查输入 if(checkfloorbrickInput(form)==false) return; var room_long=0,room_width=0,floorbrick_long=0,floorbrick_width=0; var floorbricknum=0; var rate=1.05; //给各个变量赋值 room_long=form.room_long.value*1000; room_width=form.room_width.value*1000; floorbrick_long=form.floorbrick_long.value; floorbrick_width=form.floorbrick_width.value; //开始计算 // 用砖数量(块数)=(房间的长度÷砖长)×(房间宽度÷砖宽)×1.05 floorbricknum=Math.round((room_long/floorbrick_long)*(room_width/floorbrick_width)*rate); form.floorbricknum.value=floorbricknum; } function checkfloorbrickInput(form) { if(form.room_long.value==""){ alert("请输入房间长度"); form.room_long.focus(); return false; } if(CheckNum(form.room_long.value,"房间长度只能输入数字格式!",form.room_long)==false) return false; if(form.room_width.value==""){ alert("请输入房间宽度"); form.room_width.focus(); return false; } if(CheckNum(form.room_width.value,"房间长度只能输入数字格式!",form.room_width)==false) return false; if(form.floorbrick_long.value==""){ alert("请输入地砖的长度"); form.floorbrick_long.focus(); return false; } if(CheckNum(form.floorbrick_long.value,"地砖的长度只能输入数字格式!",form.floorbrick_long)==false) return false; if(form.floorbrick_width.value==""){ alert("请输入地砖的宽度"); form.floorbrick_width.focus(); return false; } if(CheckNum(form.floorbrick_width.value,"地砖的宽度只能输入数字格式!",form.floorbrick_width)==false) return false; } function autoinput(form) { //alert(form.bricktype.value); switch(parseInt(form.bricktype.value)) { case 1: form.floorbrick_long.value=300; form.floorbrick_width.value=300; break; case 2: form.floorbrick_long.value=400; form.floorbrick_width.value=400; break; case 3: form.floorbrick_long.value=500; form.floorbrick_width.value=500; break; case 4: form.floorbrick_long.value=600; form.floorbrick_width.value=600; } } </script> </font><font color=#ff6600>1、请输入居室信息</font></td> </tr> <tr> <td width=130 height=26>房间长度</td> <td width=155 colspan=2 height=26><input class=inputinset style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" size=15 name=room_long> 米</td> </tr> <tr> <td width=130 height=26>房间宽度</td> <td colspan=2 height=26><input class=inputinset style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" size=15 name=room_width> 米</td> </tr> <tr> <td colspan=3 height=26><span class=content> <font color=#ff6600>2、请输入地砖信息</font> </span></td> </tr> <tr> <td width=130 height=26>地砖长度 </td> <td colspan=2 height=26><input class=inputinset style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" size=15 name=floorbrick_long> 毫米 </td> </tr> <tr> <td width=130 height=26>地砖宽度</td> <td colspan=2 height=26><input class=inputinset style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" size=15 name=floorbrick_width> 毫米 </td> </tr> <tr> <td height=26>选择标准规格的地砖</td> <td colspan=2 height=26><select class=inputinset style="FONT-SIZE: 9pt" onChange=autoinput(this.form) name=bricktype> <option value=1 selected>300x300</option> <option value=2>400x400</option> <option value=3>500x500</option> <option value=4>600x600</option> </select> 毫米</td> </tr> <tr> <td width=130 height=26>你需要的地砖数量</td> <td colspan=2 height=26><input class=inputinset2 style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" size=15 name=floorbricknum> 块</td> </tr> <tr> <td colspan=3 height=30><div align=center> <input class=input onClick=floor_brick(this.form) type=button value=计算 name=Submit> <input class=input type=reset value=重输 name=Submit2> </div></td> </tr> </form> </table></body> </html> |
特效说明: |
根据房间面积和地砖长宽计算所需地砖数量的地砖计算器 |
|
上一篇文章: Select实现多选下一篇文章: JS动态无限添加上传控件 |
|
|