| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1351 人关注过本帖
标题:[求助]比较繁琐的表单问题
只看楼主 加入收藏
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
正在写。
2007-09-21 15:32
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

[CODE]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.style5
{
font-size: 12px;
color: #0099FF
}
.style8 {font-size: 12px}
.style10 {font-size: 14px; color: #CC0000; }
.style12 {font-size: 12px; color: #CC3333; }
-->
</style>
<script language="javascript">
function Total_Click()
{
try
{
var TolNum=0;
TolNum+=parseInt(document.form1.StatisticsTxt[0].value);
document.form1.Total.value=TolNum.toString();
TolNum+=parseInt(document.form1.HealthTxt.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.FoodTxt[0].value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.VeterinaryTxt[0].value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.FuneralTxt.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.LaborTxt.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.CultureTxt.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.HealthServiceTxt.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.MedicalTxt[0].value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.Sewage.value);
document.form1.Total.value=TolNum;
TolNum+=parseInt(document.form1.Water.value);
document.form1.Total.value=TolNum;
}
catch(e)
{
}
}
function Qualifying_Change()
{
document.form1.ID.value=document.form1.Code.value+document.form1.Qualifying.value+document.form1.No.value;
}
function Categories_Enter()
{
if(document.form1.Area_Codes.value=='Q')
document.form1.Categories.value="企业";
else
document.form1.Categories.value="个体";
}
function EnterCode_Blur()
{
var CodeStr=document.form1.InpCode.value;
document.form1.Code.value=CodeStr.charCodeAt(0);
document.form1.Area_Codes.value=CodeStr.charAt(0);
document.form1.Outline.value=CodeStr.substr(0,3);
document.form1.Azimuth.value=CodeStr.charAt(3);
Categories_Enter();
}
function Health_Change(val)
{
document.form1.HealthTxt.value=val;
Total_Click();
}
function Statistics_Change(val)
{
if(val=="0")
{
document.form1.StatisticsTxt[0].value=val;
document.form1.StatisticsTxt[1].value=val;
}
if(val=="20")
{
document.form1.StatisticsTxt[0].value=val;
}
if(val=="10")
{
document.form1.StatisticsTxt[1].value=val;
}
Total_Click();
}
function Food_Change(val)
{
if(val=="0")
{
document.form1.FoodTxt[0].value=val;
document.form1.FoodTxt[1].value=val;
}
if(val=="35")
{
document.form1.FoodTxt[0].value=val;
}
if(val=="15")
{
document.form1.FoodTxt[1].value=val;
}
Total_Click();
}
function Veterinary_Change(val)
{
if(val=="0")
{
document.form1.VeterinaryTxt[0].value=val;
document.form1.VeterinaryTxt[1].value=val;
}
if(val=="50")
{
document.form1.VeterinaryTxt[0].value=val;
}
if(val=="150")
{
document.form1.VeterinaryTxt[1].value=val;
}
Total_Click();
}
function Chk_Click(chk,Txt)
{
if(chk.checked)
Txt.value=chk.value;
else
Txt.value=0;
Total_Click();
}
function IsNum(val)
{
var isNum=false;
try
{
var TNum=eval(val+1);
isNum=true;
}
catch(e)
{
isNum=false;
}
return isNum;
}
function TxtIsEmpty(Txt,Msg)
{
if(Txt.value=="")
{
alert(Msg+"为空");
Txt.focus();
return false;
}
return true;
}
function TxtIsNum(Txt,Msg)
{
if(!IsNum(Txt.value))
{
alert(Msg+"非数字");
Txt.focus();
return false;
}
return true;
}
function ChkA_Click(chk,Txt,iTxt,Msg)
{
if(!TxtIsEmpty(Txt,Msg))
return false;
if(!TxtIsNum(Txt,Msg))
return false;
if(chk.checked)
{
iTxt.value=eval(Txt.value+"*"+chk.value);
if(Msg=="从业人数")
document.form1.MedicalTxt[1].value=eval(Txt.value+"*"+5);
}
Total_Click();
}
</script>
</head>
<body>
<form name="form1" method="post">
<table width="817" border="0" cellpadding="0" cellspacing="0" bgcolor="#CED7F8">
<!--DWLayoutTable-->
<tr>
<td width="11" height="12"></td>
<td width="798"></td>
<td width="8"></td>
</tr>
<tr>
<td height="320"></td>
<td valign="top">
<table width="100%" bordercolor="#CED7F8" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td height="60" colspan="3" valign="buttom" class="style5"><br><br><div align="left">编号:
<input type="text" style="width:85px; " name="ID">
序号:
<input type="text" style="width:50px; " name="No">
代码:
<input type="text" style="width:25px; " name="Code">
排位:
<input type="text" style="width:30px; " onChange="Qualifying_Change();" name="Qualifying">
区码:
<input type="text" style="width:15px; " name="Area_Codes">
分区:
<input type="text" style="width:30px; " name="Outline">
方位:
<input type="text" style="width:15px; " name="Azimuth">
拼音缩写:
<input type="text" style="width:50px; " name="initials">
类别:
<input type="text" style="width:33px; " name="Categories">
</div></td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="7" height="8"></td>
<td width="345"></td>
<td width="32"></td>
<td width="400"></td>
</tr>
<!--DWLayoutTable-->
<tr>
<td height="238"></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="333" height="12"></td>
<td width="19"></td>
</tr>
<tr>
<td height="17" valign="top"><span class="style8">&nbsp;输入编码:
<input type="text" style="width:70px;" maxlength="4" onBlur="EnterCode_Blur();" name="InpCode">
</span></td>
<td valign="center"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="16" valign="top"><span class="style8">&nbsp;字号名称:
<input type="text" name="Name">
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
</tr>
<tr>
<td height="1"></td>
<td rowspan="2" valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="17" valign="top"><span class="style8">&nbsp;业主姓名:
<input type="text" style="width:120px; " name="Owners_Name">
</span></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="18" valign="top"><span class="style8">&nbsp;联系电话:
<input type="text" style="width:95px; " name="Phone">
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="17" valign="top"><span class="style8">&nbsp;从业人数:
<input name="Number_of" type="text" style="width:39px; " value="0">
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="17" valign="top"><span class="style8">&nbsp;经营面积:
<input name="Area" type="text" style="width:39px; " value="0">
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="21" valign="top"><span class="style8">&nbsp;所属行业:
<select style="width:70px;" name="Industry">
</select>
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="21" valign="top"><span class="style8">&nbsp;减免证件:
<select style="width:100px;" name="Relief">
</select>
</span></td>
<td valign="top"><div align="center"><span class="style10">*</span></div></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="21" valign="center"><span class="style8">&nbsp;&nbsp;现定费:
<input type="radio" name="Fixed" value="Yes">
暂不定:
<input type="radio" name="Fixed" value="No">
</span></td>
<td></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><span class="style8">&nbsp;截止日期:
<input type="text" style="width:95px; " name="EndDate">
</span></td>
<td></td>
</tr>
</table></td>
<td valign="center" class="style10">
<div align="left">带<br>
[*]<br>
号的<br>
必<br>
填!
</div> </p></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="132" height="21" valign="center"><div align="right"><span class="style8">统计证:

</span></div></td>
<td colspan="2" valign="top">
<select name="Statistics" onChange="Statistics_Change(this.options[this.selectedIndex].value);">
<option value="20">新办</option>
<option value="10">年检</option>
<option value="0" >不选择</option>
</select></td>
<td width="55">&nbsp;</td>
<td width="15">&nbsp;</td>
<td colspan="2" valign="top"><input name="StatisticsTxt" type="text" style="width:30px; " value="0">
<input name="StatisticsTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="21" valign="center"><div align="right"><span class="style8">卫生许可证:</span></div></td>
<td colspan="2" valign="top"><select name="Health" onChange="Health_Change(this.options[this.selectedIndex].value);">
<option value="35">新办</option>
<option value="10">年检</option>
<option value="0">不选择</option>
</select></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="HealthTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="21" valign="center"><div align="right"><span class="style8">食品卫生合格证:</span></div></td>
<td colspan="2" valign="top"><select name="Food" onChange="Food_Change(this.options[this.selectedIndex].value);">
<option value="35">新办</option>
<option value="15">年检</option>
<option value="0">不选择</option>
</select></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="FoodTxt" type="text" style="width:30px; " value="0">
<input name="FoodTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="21" valign="center"><div align="right"><span class="style8">兽医证:</span></div></td>
<td colspan="3" valign="top"><select name="Veterinary" onChange="Veterinary_Change(this.options[this.selectedIndex].value);">
<option value="0">不选择</option>
<option value="50">肉类卫生合格证</option>
<option value="150">动物防疫合格证</option>
</select></td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="VeterinaryTxt" type="text" style="width:30px; " value="0">
<input name="VeterinaryTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="17" valign="center"><div align="right"><span class="style8">殡葬市场管理费:</span></div></td>
<td width="25" valign="top"><input type="checkbox" name="Funeral" onClick="Chk_Click(this,document.form1.FuneralTxt);" value="600"></td>
<td width="38">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="FuneralTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="16" valign="top"><div align="right"><span class="style8">劳动用工年检费:</span></div></td>
<td valign="top"><input type="checkbox" name="Labor" onClick="Chk_Click(this,document.form1.LaborTxt);" value="110"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="LaborTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="16" valign="top"><div align="right"><span class="style8">文化经营许可证:</span></div></td>
<td valign="top"><input type="checkbox" onClick="Chk_Click(this,document.form1.CultureTxt);" name="Culture" value="20"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="CultureTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="16" valign="top"><div align="right" class="style8">卫生有偿服务费:</div></td>
<td valign="top"><input type="checkbox" onClick="ChkA_Click(this,document.form1.Area,document.form1.HealthServiceTxt,'经营面积');" name="HealthService" value="0.5"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="HealthServiceTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="16" valign="top"><div align="right"><span class="style8">体检费:</span></div></td>
<td valign="top"><input type="checkbox" name="Medical" onClick="ChkA_Click(this,document.form1.Number_of,document.form1.MedicalTxt[0],'从业人数');" value="50"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><input name="MedicalTxt" type="text" style="width:30px; " value="0">
<input name="MedicalTxt" type="text" style="width:30px; " value="0"></td>
</tr>
<tr>
<td height="17" valign="top"><div align="right" class="style8">排污费:</div></td>
<td colspan="2" valign="top"><input name="Sewage" type="text" onChange="Total_Click();" style="width:50px; " value="0"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td width="72" valign="top"><div align="center"><span class="style12">合计</span></div></td>
<td width="63">&nbsp;</td>
</tr>
<tr>
<td height="18" valign="top"><div align="right" class="style8">水资源费:</div></td>
<td colspan="2" valign="top"><input name="Water" type="text" onChange="Total_Click();" style="width:50px; " value="0"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td valign="top"><div align="center">
<input name="Total" type="text" onClick="Total_Click();" style="width:50px; ">
</div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td colspan="4" valign="top"><div align="center" class="style8">[返回]</div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="27">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td height="33"></td>
<td colspan="3" valign="center"><div align="center">
<input type="submit" name="Submit" value="提交">&nbsp;
<input name="Reset" type="reset" value="重置">
&nbsp;
<input type="button" name="Close" value="关闭">&nbsp;
</div></td>
</tr>
<tr>
<td height="5"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table></td>
<td></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height="25"></td>
<td>&nbsp;</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>[/CODE]
楼主要的代码
除了拼音缩写和排位没有实现。

2007-09-21 20:45
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
yms123版主功力很强,学习一下!
2007-09-21 21:22
enirilt
Rank: 1
等 级:新手上路
帖 子:126
专家分:0
注 册:2006-11-29
收藏
得分:0 

谢谢您,也很感激!把最关键的几个给解决了,因为这几个值在下一步做统计筛选时是必不可少的,至于排位问题我想应该首先从数据表里判断同样的编号记录有几条,然后在记录值上+1的思路去考虑才对是吧,而且编号、序号、排位这几项没必要在这个表单上实现,只是新一条记录添加到数据表过程中传递给表里就可以了,因为日期型的编号是这个道理,不知说的对不对,我自己努力去做,不忍心再占用您的宝贵时间,不过实在不行还会来的!再次谢谢您!向您学习!

2007-09-22 00:02
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
以下是引用enirilt在2007-9-22 0:02:47的发言:

谢谢您,也很感激!把最关键的几个给解决了,因为这几个值在下一步做统计筛选时是必不可少的,至于排位问题我想应该首先从数据表里判断同样的编号记录有几条,然后在记录值上+1的思路去考虑才对是吧,而且编号、序号、排位这几项没必要在这个表单上实现,只是新一条记录添加到数据表过程中传递给表里就可以了,因为日期型的编号是这个道理,不知说的对不对,我自己努力去做,不忍心再占用您的宝贵时间,不过实在不行还会来的!再次谢谢您!向您学习!

不过做Web开发javascript很重要,有些时候光用VBScript解决不了的问题就可以用javascript进行弥补。一些服务器端实现困难的功能,就可以用javascript来做。

2007-09-22 10:43
enirilt
Rank: 1
等 级:新手上路
帖 子:126
专家分:0
注 册:2006-11-29
收藏
得分:0 

找到了个宿写字母代码,供大家参考!
<script LANGUAGE=vbscript>
<!--
function getchar(char)
charobj=65536+asc(char)
if(charobj>=45217 and charobj<=45252) then
getchar= "A"
elseif(charobj>=45253 and charobj<=45760) then
getchar= "B"
elseif(charobj>=45761 and charobj<=46317) then
getchar= "C"
elseif(charobj>=46318 and charobj<=46825) then
getchar= "D"
elseif(charobj>=46826 and charobj<=47009) then
getchar= "E"
elseif(charobj>=47010 and charobj<=47296) then
getchar= "F"
elseif(charobj>=47297 and charobj<=47613) then
getchar= "G"
elseif(charobj>=47614 and charobj<=48118) then
getchar= "H"
elseif(charobj>=48119 and charobj<=49061) then
getchar= "J"
elseif(charobj>=49062 and charobj<=49323) then
getchar= "K"
elseif(charobj>=49324 and charobj<=49895) then
getchar= "L"
elseif(charobj>=49896 and charobj<=50370) then
getchar= "M"
elseif(charobj>=50371 and charobj<=50613) then
getchar= "N"
elseif(charobj>=50614 and charobj<=50621) then
getchar= "O"
elseif(charobj>=50622 and charobj<=50905) then
getchar= "P"
elseif(charobj>=50906 and charobj<=51386) then
getchar= "Q"
elseif(charobj>=51387 and charobj<=51445) then
getchar= "R"
elseif(charobj>=51446 and charobj<=52217) then
getchar= "S"
elseif(charobj>=52218 and charobj<=52697) then
getchar= "T"
elseif(charobj>=52698 and charobj<=52979) then
getchar= "W"
elseif(charobj>=52980 and charobj<=53640) then
getchar= "X"
elseif(charobj>=53689 and charobj<=54480) then
getchar= "Y"
elseif(charobj>=54481 and charobj<=62289) then
getchar= "Z"
else
getchar=char
end if
end function

function getpy(str)
for i=1 to len(str)
getpy=getpy&getchar(mid(str,i,1))
next
end function

function ff()
d=document.all.form1.str1.value
document.all.form1.str2.value=getpy(d)
end function
//-->
</script>

2007-09-26 18:04
快速回复:[求助]比较繁琐的表单问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036128 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved