| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1429 人关注过本帖
标题:[求助]怎样用ASP语言在DW中控制文本框的文字数量。
取消只看楼主 加入收藏
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
结帖率:68.57%
收藏
 问题点数:0 回复次数:3 
[求助]怎样用ASP语言在DW中控制文本框的文字数量。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file = "checkinfoadmin.asp"--> <!-- #include file="conn.asp" --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>:::来搞信息登记:::</title> <link href="../css/fontsize.css" rel="stylesheet" type="text/css"> <link href="../css/input_form.css" rel="stylesheet" type="text/css"> <link href="../css/inputform1.css" rel="stylesheet" type="text/css"> <link href="../css/selectform.css" rel="stylesheet" type="text/css"> <link href="../css/inputform2.css" rel="stylesheet" type="text/css"> <link href="../css/inputform3.css" rel="stylesheet" type="text/css"> <link href="../css/inputform3.css" rel="stylesheet" type="text/css"> <link href="../css/link.css" rel="stylesheet" type="text/css"> <link href="../css/buttoncss.css" rel="stylesheet" type="text/css"> <link href="../css/inputchaxun.css" rel="stylesheet" type="text/css"> <link href="../css/city.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { background-image: url(../pictures/beij.jpg); } .style3 {font-size: 18px} .style5 {color: #003300} .style6 {color: #0000FF} .style7 {color: #660000} --> </style></head> <body bgcolor="#6699cc" > <p> <% '--------------------------删除单条记录 if request("method")="del" then id=request("id") sql = "DELETE FROM tongxunyuan WHERE id=" + cstr(id) conn.execute sql response.Write "<script >" response.Write("alert('删除操作成功!');") response.Write("window.navigate('tongxunyuan.asp')") response.Write("</script>") %> <% end if %> </p> <p align="center">&nbsp;</p> <p align="center" class="style3">来 搞 信 息 登 记</p> <table width="72%" border="0" align="center" cellpadding="0" cellspacing="0" area="fontsize"> <tr> <td width="100%"></td> </tr> <tr> <td> <form name="input_form" action="add_laigaodengji.asp" method="post" onSubmit="return checkform();"> <table width="680" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse"> <tr> <td height="24" colspan="3"><div align="left"><font size="2">&nbsp; &nbsp;&nbsp; 以下为添加来稿信息部分 (带<font color="#FF0000">*<font color="#000000">为必填项</font></font>):</font> </div></td> <td height="24"><font size="2"> <div align="center">登记人员<span class="style5">:<span class="style6"><%=session("name")%></span></span></div></td> </tr> <tr> <td width="140"><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="50" height="15"><font size="2">省份:</font> </td> </tr> </table> </div></td> <td width="196"><div align="left"> <font size="2"> <select name="province" area="selectformat" id="province" onMouseOver="this.focus();" onChange="make_city_menu(this.value,document.input_form.city)"> <option value="" selected>--省份信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from province order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("province")%>" ><%=rs("province")%></option> <% rs.movenext loop end if %> </select> </font><font color="#FF0000">*</font><font size="2"> </font></div></td> <td width="167"><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">通讯员:</font></td> </tr> </table> </div></td> <td width="167"><div align="left"> <font size="2"> <select name=txy class="selectformat" id="select19" onmouseover="this.focus();" > <option selected>-通讯员信息-</option> </select> </font><font color="#FF0000"> *</font></div></td> </tr> <tr> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="83" height="15"><font size="2">地州:</font> </td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <select name="city" area="selectformat" id="city" onMouseOver="this.focus();" onChange="make_area_menu(this.value,document.input_form.area)"> <option value="" selected>--地区信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from city order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("city")%>" ><%=rs("city")%></option> <% rs.movenext loop end if %> </select> </font><font color="#FF0000">*</font></div></td> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">性 别:</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <input name="get_sex" type="radio" class="fontsize" value="男" checked> 男 <input name="get_sex" type="radio" class="fontsize" value="女"> 女 </font><font color="#FF0000"> *</font></div></td> </tr> <tr> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">县(市):</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <select name="area" area="selectformat" id="area" onMouseOver="this.focus();" onChange="make_txy_menu(this.value,document.input_form.txy)"> <option value="" selected>--县市信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from area order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("area")%>" ><%=rs("area")%></option> <% rs.movenext loop end if %> </select> </font><font color="#FF0000">*</font></div></td> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">联系电话:</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <input name="get_tel" type="text" id="get_tel" onMouseOver="this.focus();" size="13.5" txy="inputform1"> </font><font color="#FF0000"> *</font></div></td> </tr> <tr> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">来稿日期:</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <input name="get_lgrq" type="text" id="get_lgrq" onMouseOver="this.focus();" value="<%=date()%>" size="13.5" txy="inputform1"> </font><font color="#FF0000"> *</font></div></td> <td><div align="right"> <table width="100" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">登记日期:</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <input name="get_djrq" type="text" id="get_djrq" onMouseOver="this.focus();" value="<%=date()%>" size="13.5" txy="inputform1"> </font><font color="#FF0000"> *</font></div></td> </tr> <tr align="center" valign="middle"> <td height="30" colspan="4"><font size="2"><span class="style7"><strong>来 搞 稿 件 标 题</strong><font size="2">&nbsp;</font> </span><font color="#FF0000">&nbsp; </font></td> </tr> <tr align="center" valign="middle"> <td height="30" colspan="4"><input name="get_gjbt" type="text" id="get_gjbt" size="80"> <font size="2">&nbsp; </font><font color="#FF0000"> *</font></td> </tr> <tr align="center" valign="middle"> <td height="30" colspan="4"><font size="2"><span class="style7"><strong>稿 件 内 容 简 介</strong><font size="2">&nbsp;</font> </span><font color="#FF0000">&nbsp; </font></td> </tr> <tr align="center" valign="middle"> <td height="100" colspan="4" align="center" valign="middle"><textarea name="get_gjnrjj" cols="78" rows="5" id="get_gjnrjj"></textarea> <font size="2">&nbsp; </font><font color="#FF0000"> *</font></td> </tr> <tr> <td height="43" colspan="4"> <div align="center"> <input type=submit value=完成录入 name=Submit> &nbsp; <input type=reset value=清空重写 name=Submit_a> </div></td> </tr> </table> </form></td> </tr> <tr> <td>&nbsp;</td> </tr> </table> <% rs.close set rs = nothing conn.close set conn = nothing %> </body> <script language="JavaScript" > function make_city_menu(province_value,city_X) { var sql = "select * from city where province='"+province_value+"'" ; var ConnDB = new ActiveXObject("adodb.connection"); var rs = new ActiveXObject("ADODB.Recordset"); ConnDB.ConnectionString="DSN=data;uid=data;pwd=data"; ConnDB.open rs.open(sql,ConnDB,1,1); if(rs.recordcount!=0) { var count=1; city_X.options[0]=new Option("--地区信息--",""); while(!rs.eof) { city_X.options[count]=new Option(rs("city"),rs("city")); count=count+1; rs.movenext } var sql=null; rs.close ConnDB.close city_X.options[0].selected=true; city_X.length=count; } else { city_X.options[0]=new Option("--地区信息--",""); var sql=null; rs.close ConnDB.close city_X.options[0].selected=true; city_X.length=1; } } function make_area_menu(city_value,area_X) { var sql = "select * from area where city='"+city_value+"'" ; var ConnDB = new ActiveXObject("adodb.connection"); var rs = new ActiveXObject("ADODB.Recordset"); ConnDB.ConnectionString="DSN=data;uid=data;pwd=data"; ConnDB.open rs.open(sql,ConnDB,1,1); if(rs.recordcount!=0) { var count=1; area_X.options[0]=new Option("--县市信息--",""); while(!rs.eof) { area_X.options[count]=new Option(rs("area"),rs("area")); count=count+1; rs.movenext } var sql=null; rs.close ConnDB.close area_X.options[0].selected=true; area_X.length=count; } else { area_X.options[0]=new Option("--县市信息--",""); var sql=null; rs.close ConnDB.close area_X.options[0].selected=true; area_X.length=1; } } function make_txy_menu(area_value,txy_X) { var sql = "select * from tongxunyuan where area='"+area_value+"'" ; var ConnDB = new ActiveXObject("adodb.connection"); var rs = new ActiveXObject("ADODB.Recordset"); ConnDB.ConnectionString="DSN=data;uid=data;pwd=data"; ConnDB.open rs.open(sql,ConnDB,1,1); if(rs.recordcount!=0) { var count=1; txy_X.options[0]=new Option("-通讯员信息-",""); while(!rs.eof) { txy_X.options[count]=new Option(rs("txy"),rs("txy")); count=count+1; rs.movenext } var sql=null; rs.close ConnDB.close txy_X.options[0].selected=true; txy_X.length=count; } else { txy_X.options[0]=new Option("-通讯员信息-",""); var sql=null; rs.close ConnDB.close txy_X.options[0].selected=true; txy_X.length=1; } } function checkform() { var subst = document. input_form; if (subst.province.value=="") { alert("省份信息不能为空!"); subst.province.focus(); return false; } if (subst.city.value=="") { alert(" 地州市信息不能为空!"); subst.city.focus(); return false; } if (subst.area.value=="") { alert(" 县(市)信息不能为空!"); subst.area.focus(); return false; } if (subst.txy.value=="") { alert("通讯员信息不能为空!"); subst.txy.focus(); return false; } if (subst.get_sex.value=="") { alert("通讯员性别不能为空!"); subst.get_sex.focus(); return false; } if (subst.get_tel.value=="") { alert("通讯员联系电话不能为空!"); subst.get_tel.focus(); return false; } if (subst.get_lgrq.value=="") { alert("来搞时间信息不能为空!"); subst.get_lgrq.focus(); return false; } if (subst.get_djrq.value=="") { alert("稿件登记日期信息不能为空!"); subst.get_djrq.focus(); return false; } if (subst.get_gjbt.value=="") { alert("稿件标题信息不能为空!"); subst.get_gjbt.focus(); return false; } if (subst.get_gjnrjj.value=="") { alert("稿件内容信息不能为空!"); subst.get_gjnrjj.focus(); return false; } if(subst.get_tel.value!="") { if(onlyNum_Point(subst.get_tel.value)==0) { alert("通讯员联系电话只能输入数字!"); subst.get_tel.focus(); return false; } } return true; } function onlyNum_Point(NUM) { var i,j,strTemp; strTemp="0123456789.-/"; if ( NUM.length== 0) return 0 for (i=0;i<NUM.length;i++) { j=strTemp.indexOf(NUM.charAt(i)); if (j==-1) { //说明有字符不是数字 return 0; } } //说明是数字 return 1; } function SureDelSingle(id) { if ( confirm("您确定要删除该通讯员信息吗?")) { window.location.href = "tongxunyuan.asp?method=del&id=" +id; } } </script> </html>

[此贴子已经被作者于2005-8-17 12:46:33编辑过]

搜索更多相关主题的帖子: css 语言 文本 ASP 
2005-08-17 12:38
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
稿件标题和稿件内容简介的内容输多了以后,在保存时出错,哥们有没有好的办法呀!

如我想让内容简介的内容最多为1000字,那又怎么用ASP来写?谢先!

我是农家的孩子,我有农家孩子的本色!
2005-08-17 12:49
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
非常感谢!!

我是农家的孩子,我有农家孩子的本色!
2005-08-17 17:34
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
非常感谢!! 已成功!

我是农家的孩子,我有农家孩子的本色!
2005-08-18 12:14
快速回复:[求助]怎样用ASP语言在DW中控制文本框的文字数量。
数据加载中...
 
   



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

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