救命!ASP算法问题!很急!高分求代码!

aspxx112 2005-05-18 09:12:17
求救啊!!大哥大姐们救命啊!!刚学会ASP好多不懂,东西又急着要,很急知道的请帮帮我!!!

问题如下

用户只要填写数量,就可以自动算出多少箱,多出多少数量

一箱为100件 数量sl 箱数xs 多于数量dysl

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title></title>
</head>

<body>

<form method="POST" action="">

数量<input type="text" name="sl" size="7">
箱数<input type="text" name="xs" size="7">
多出数量<input type="text" name="rkxs" size="7">


<input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2">
</form>

</body>

</html>
...全文
161 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
king2410 2005-05-18
  • 打赏
  • 举报
回复
双星老大出手了,可以揭贴了,写到数据库你那边代码也应该有的
aspxx112 2005-05-18
  • 打赏
  • 举报
回复
就是数量sl给用户填写,自动算出箱数和多出的数量
然后把这三个字段存到数据库 LK表里就行了
baiyunfei 2005-05-18
  • 打赏
  • 举报
回复
<script language="javascript">
function CountValue(value)
{
if(isNaN(value)||value.replace(/ /g,"")=="")
{
document.all.xs.value="";
document.all.rkxs.value="";
return;
}
var xs,dcsl;
xs=parseInt(parseInt(value)/100);
dcsl=parseInt(value)%100;
document.all.xs.value=xs;
document.all.rkxs.value=dcsl;
}
</script>
数量<input type="text" name="sl" size="7" onpropertychange="CountValue(this.value)">
箱数<input type="text" name="xs" size="7" readOnly>
多出数量<input type="text" name="rkxs" size="7" readOnly>
jekexys2004 2005-05-18
  • 打赏
  • 举报
回复
关键就是
s1 = Request("s1")
xs = s1 / 100 '多少箱
rkxs = s1 mod 100 '多出数量

楼主的意思是这样吗?
ypengfei 2005-05-18
  • 打赏
  • 举报
回复
<form method="POST" action="make.asp">


---make.asp

<%
s1 = Request("s1")
xs = s1 / 100 '多少箱
rkxs = s1 mod 100 '多出数量
Response.write("箱数:"& xs)
Response.write("多出数量:" & rkxs)
%>

---用JS也是很简单的。用ASP确更麻烦了。
baikaishui_0825 2005-05-18
  • 打赏
  • 举报
回复
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title></title>
</head>

<body>
<%
if request("sl")<>"" then
xs=cint(request("sl"))\100
rkxs=cint(request("sl")) mod 100
end if
%>

<form method="POST" action="">

数量<input type="text" name="sl" size="7" value="<%=request("sl")%>">
箱数<input type="text" name="xs" size="7" value="<%=xs%>">
多出数量<input type="text" name="rkxs" size="7" value="<%=rkxs%>">


<input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2">
</form>

</body>

</html>

yousite1 2005-05-18
  • 打赏
  • 举报
回复
这是javascript白痴
yyq136 2005-05-18
  • 打赏
  • 举报
回复
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title></title>
<script>
function jisuan1()
{
var str1,str2,station1;
station1=document.form1.sl.value;
str1=(parseInteger(station1)/100);
str2=(parseInteger(station1)\100);
document.form1.xs.value=str1;
document.form1.rkxs.value=str2;


}
</script>
</head>

<body>

<form method="POST" action="" name="form1">

数量<input type="text" name="sl" size="7" onblur="jisuan1()">
箱数<input type="text" name="xs" size="7">
多出数量<input type="text" name="rkxs" size="7">


<input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2">
</form>

</body>

</html>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧