代码如下: <!--#include file="../dblink/connectsqlserver.inc"--> <!--#include file="jobPublic.asp"--> <% cmd=Request("cmd") %> <html> <head> <script language="JavaScript"> function checksubmit() { if (document.form1.SendMess.value=="" ) { alert('请输入发送内容!'); return false; } if (document.form1.ReceMobNo.value=="" ) { alert('请输入收信人手机号码!'); return false; } document.form1.action="SmsEdit.asp?cmd=SAVE" document.form1.submit(); return true; }function SelectMobNo(Itype,Icode) { var SelectValue = window.showModalDialog("SelectMobNo.asp?type="+Itype+"&Code="+Icode,'newwin','dialogHeight: 320px; dialogWidth: 450px; edge: Raised; center: Yes; help: no; resizable: no; status: no;'); if (SelectValue!=null) { for(i=0;i<SelectValue.length;i++) { document.form1.ReceMobNo.options[i].text=SelectValue[i]; document.form1.ReceMobNo.options[i].value=SelectValue[i]; } return true; } } //删除手机号 function selectMove(oSource) { if(oSource.selectedIndex==-1) { alert("操作前您首先应该从列表中选择一项!"); return; } var mySld=new Array(); for(i=0;i<oSource.options.length;i++) if(oSource.options[i].selected) mySld[mySld.length++]=i; for(i=0;i<mySld.length;i++) { for(j=mySld[i]-i;j<oSource.options.length-1;j++) { oSource.options[j].text=oSource.options[j+1].text; oSource.options[j].value=oSource.options[j+1].value; } oSource.options.length--; } } </script> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <Link Rel="styleSheet" Href="..\menus_bak\css\EbestStyle.css" Type="text/css"> </head> <body bgcolor="#6699CC"> <%logname=session("log_name") if logname=empty then Response.Write "超时连接请重新登入!" Response.end else dim My_Name,PersonCode '取本人的姓名,发信人手机号 PersonCode=getpercode(logname) My_Name=GetPersonName(PersonCode) set rs=server.createobject("adodb.recordset") sql="select person_name,mob_no from oa_person where person_name='"&my_name&"'" rs.open sql,cnndb if not rs.eof then if rs("mob_no")="" then V_SendMobNo="" else V_SendMobNo=rs("mob_no") end if end if rs.close set rs=nothing
'新记录 if cmd=empty then if Request("ReceMobNo")=empty then V_ReceMobNo="" else V_ReceMobNo=Request("ReceMobNo") end if if Request("RecePerson")=empty then V_RecePerson="" else V_RecePerson=Request("RecePerson") end if V_SendMess="" end if
'插入新记录 if cmd="SAVE" then 'MessId=GetMaxMessID(PersonCode,0) M_ReceMobNo=Request("ReceMobNo")+";" M_RecePerson=Request("RecePerson")+";" M_SendMess=Request("SendMess") M_SendPerson=Request("SendPerson") M_SendMobNo=Request("SendMobNo") j=InStr(M_ReceMobNo,";") k=InStr(M_RecePerson,";") i=0 do until j=0 Left_ReceMobNo=mid(M_ReceMobNo,1,j-1) M_ReceMobNo=mid(M_ReceMobNo,j+1) j=InStr(M_ReceMobNo,";") M_SendMess=replace(M_SendMess,"’","'") if k>=1 then Left_RecePerson=mid(M_RecePerson,1,k-1) M_RecePerson=mid(M_RecePerson,k+1) k=InStr(M_RecePerson,";") end if MessId=GetMaxMessID(PersonCode,i) sql_order = "insert into OA_MOB_MESSAGE(MESS_ID,ACT_DATE,SEND_PERSON,SEND_MOB_NO," &_ "SEND_MESSAGE,RECE_MOB_NO,RECE_PERSON,MESS_TYPE) values('" & MessId &_ "',SYSDATE,'"& M_SendPerson & "','" & M_SendMobNo &"','" & M_SendMess &_ "','" & Left_ReceMobNo &"','"&Left_RecePerson&"','发送信息')" cnndb.execute sql_order i=i+1 loop Response.Redirect "SmsShow.asp" end if
'修改原来记录,继续新的发送 if cmd="UPDATE" then MessID=Request("MessID") sql="SELECT RECE_PERSON,RECE_MOB_NO,SEND_MESSAGE,SEND_MOB_NO FROM OA_MOB_MESSAGE" &_ " WHERE Mess_ID ='" & MessID &"'" 'response.Write(sql) 'response.end set rsJob = server.createobject("adodb.recordset") rsJob.open sql,cnndb if not rsJob.eof then V_ReceMobNo =rsJob("RECE_MOB_NO") V_RecePerson=rsJob("RECE_PERSON") V_SendMess =rsJob("SEND_MESSAGE") V_SendMobNo =rsJob("SEND_MOB_NO") end if rsJob.Close set rsJob=nothing end if
'删除发送记录,实际上是打个标记Re="用户已经删除" if cmd="DELETE" then MessID=Request("MessID") sql_order = "UPDATE OA_MOB_MESSAGE SET REMARK='用户已经删除' WHERE MESS_ID='" & MessID &"'" cnndb.execute sql_order Response.Redirect "SmsShow.asp" end if %>
一定要在 form1.select_pc load后再执行。
试过了不行的,
<!--#include file="../dblink/connectsqlserver.inc"-->
<!--#include file="jobPublic.asp"-->
<%
cmd=Request("cmd")
%>
<html>
<head>
<script language="JavaScript">
function checksubmit()
{
if (document.form1.SendMess.value=="" )
{
alert('请输入发送内容!');
return false;
}
if (document.form1.ReceMobNo.value=="" )
{
alert('请输入收信人手机号码!');
return false;
}
document.form1.action="SmsEdit.asp?cmd=SAVE"
document.form1.submit();
return true;
}function SelectMobNo(Itype,Icode)
{ var SelectValue = window.showModalDialog("SelectMobNo.asp?type="+Itype+"&Code="+Icode,'newwin','dialogHeight: 320px; dialogWidth: 450px; edge: Raised; center: Yes; help: no; resizable: no; status: no;');
if (SelectValue!=null)
{
for(i=0;i<SelectValue.length;i++)
{
document.form1.ReceMobNo.options[i].text=SelectValue[i];
document.form1.ReceMobNo.options[i].value=SelectValue[i];
}
return true;
}
}
//删除手机号
function selectMove(oSource)
{ if(oSource.selectedIndex==-1)
{
alert("操作前您首先应该从列表中选择一项!");
return;
} var mySld=new Array();
for(i=0;i<oSource.options.length;i++)
if(oSource.options[i].selected)
mySld[mySld.length++]=i; for(i=0;i<mySld.length;i++)
{
for(j=mySld[i]-i;j<oSource.options.length-1;j++)
{
oSource.options[j].text=oSource.options[j+1].text;
oSource.options[j].value=oSource.options[j+1].value;
}
oSource.options.length--;
}
}
</script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Link Rel="styleSheet" Href="..\menus_bak\css\EbestStyle.css" Type="text/css">
</head>
<body bgcolor="#6699CC">
<%logname=session("log_name")
if logname=empty then
Response.Write "超时连接请重新登入!"
Response.end
else
dim My_Name,PersonCode '取本人的姓名,发信人手机号
PersonCode=getpercode(logname)
My_Name=GetPersonName(PersonCode)
set rs=server.createobject("adodb.recordset")
sql="select person_name,mob_no from oa_person where person_name='"&my_name&"'"
rs.open sql,cnndb
if not rs.eof then
if rs("mob_no")="" then
V_SendMobNo=""
else
V_SendMobNo=rs("mob_no")
end if
end if
rs.close
set rs=nothing
'新记录
if cmd=empty then
if Request("ReceMobNo")=empty then
V_ReceMobNo=""
else
V_ReceMobNo=Request("ReceMobNo")
end if
if Request("RecePerson")=empty then
V_RecePerson=""
else
V_RecePerson=Request("RecePerson")
end if
V_SendMess=""
end if
'插入新记录
if cmd="SAVE" then
'MessId=GetMaxMessID(PersonCode,0)
M_ReceMobNo=Request("ReceMobNo")+";"
M_RecePerson=Request("RecePerson")+";"
M_SendMess=Request("SendMess")
M_SendPerson=Request("SendPerson")
M_SendMobNo=Request("SendMobNo")
j=InStr(M_ReceMobNo,";")
k=InStr(M_RecePerson,";")
i=0
do until j=0
Left_ReceMobNo=mid(M_ReceMobNo,1,j-1)
M_ReceMobNo=mid(M_ReceMobNo,j+1)
j=InStr(M_ReceMobNo,";")
M_SendMess=replace(M_SendMess,"’","'")
if k>=1 then
Left_RecePerson=mid(M_RecePerson,1,k-1)
M_RecePerson=mid(M_RecePerson,k+1)
k=InStr(M_RecePerson,";")
end if
MessId=GetMaxMessID(PersonCode,i)
sql_order = "insert into OA_MOB_MESSAGE(MESS_ID,ACT_DATE,SEND_PERSON,SEND_MOB_NO," &_
"SEND_MESSAGE,RECE_MOB_NO,RECE_PERSON,MESS_TYPE) values('" & MessId &_
"',SYSDATE,'"& M_SendPerson & "','" & M_SendMobNo &"','" & M_SendMess &_
"','" & Left_ReceMobNo &"','"&Left_RecePerson&"','发送信息')"
cnndb.execute sql_order
i=i+1
loop
Response.Redirect "SmsShow.asp"
end if
'修改原来记录,继续新的发送
if cmd="UPDATE" then
MessID=Request("MessID")
sql="SELECT RECE_PERSON,RECE_MOB_NO,SEND_MESSAGE,SEND_MOB_NO FROM OA_MOB_MESSAGE" &_
" WHERE Mess_ID ='" & MessID &"'"
'response.Write(sql)
'response.end
set rsJob = server.createobject("adodb.recordset")
rsJob.open sql,cnndb
if not rsJob.eof then
V_ReceMobNo =rsJob("RECE_MOB_NO")
V_RecePerson=rsJob("RECE_PERSON")
V_SendMess =rsJob("SEND_MESSAGE")
V_SendMobNo =rsJob("SEND_MOB_NO")
end if
rsJob.Close
set rsJob=nothing
end if
'删除发送记录,实际上是打个标记Re="用户已经删除"
if cmd="DELETE" then
MessID=Request("MessID")
sql_order = "UPDATE OA_MOB_MESSAGE SET REMARK='用户已经删除' WHERE MESS_ID='" & MessID &"'"
cnndb.execute sql_order
Response.Redirect "SmsShow.asp"
end if
%>
接上贴:
<form name="form1" method="post" action="">
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#99CCFF">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="75%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#D5B007" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img border="0" src="../images/cgrw_J4.jpg" width="11" height="22"></td>
<td><font color="#FFFFFF" class="font3" face="隶书">手机短消息--编写新消息</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="25%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<p align="right"><img border="0" src="../images/h_jiao1.jpg" width="14" height="22"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="75%" background=".../images/h_bak.jpg">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="26"><img border="0" src="../images/h_arrow.jpg" width="26" height="17"></td>
<td valign="bottom"> </td>
<td valign="bottom"></td>
</tr>
</table>
</td>
<td width="25%" bgcolor="#CCEFFF"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%"><img border="0" src="../images/picture14.jpg" width="288" height="36"></td>
</tr>
<tr>
<td>
<table width="75%" border="0" align="center" cellspacing="0" bgcolor="#CCEFFF" cellpadding="0" bordercolorlight="#4464DC" bordercolordark="#99CCFF" id="eeee">
<tr>
<td height="10" width="10%"><div align="center"> </td>
<td height="30" width="14%"><div align="center"> </td>
<td>
</td>
<td>
</td></tr>
<tr>
<td height="30" rowspan="2" width="10%"><div align="center"> </td>
<td height="30" rowspan="2" width="16%"><div align="center"><b>收信人手机号码<font color="red">*</font></b></div></td>
<td width="30%" rowspan="2">
<select size=5 style="width:375px;" name=ReceMobNo ondblclick="alert('OK')" multiple>
<option vlaue="">
</select>
</td>
<td width="20%" height="30" valign="middle">
<img src="../images/add0.gif" alt="添加手机号码" onmouseout="javascript:this.src='../images/add0.gif'" onmouseover="javascript:this.src='../images/add1.gif'" style="cursor:hand" onclick="SelectMobNo(2,1)" ></td>
</tr>
<td height="30" width="20%" valign="middle">
<img src="../images/plus0.gif" alt="删除手机号码" onmouseout="javascript:this.src='../images/plus0.gif'" onmouseover="javascript:this.src='../images/plus1.gif'" style="cursor:hand" onclick=selectMove(document.form1.ReceMobNo) >
</td>
<tr>
</tr>
<tr>
<td height="30" width="10%"><div align="center"> </td>
<td ><div align="center"><b>发送内容<font color="red">*<BR>小于50个汉字</font></b></div></td>
<td>
<TEXTAREA id=SendMess name=SendMess rows=5 cols=60><%=V_SendMess%></TEXTAREA>
</td>
<td></td>
</tr>
<tr>
<td height="30" width="10%"><div align="center"> </td>
<td height="30" width="16%"><div align="center"><b>发 信 人<font color="red">*</font></b></div></td>
<td><input type="text" name="SendPerson" readonly=true size="30" value="<%=My_Name%>">
</td>
<td></td></tr>
<tr>
<td height="30" width="10%"><div align="center"> </td>
<td height="30" width="16%"><div align="center"><b>发信人手机号码</b></div></td>
<td><input type="text" name="SendMobNo" size="30" value="<%=V_SendMobNo%>">
</td>
<td>
</td></tr>
<tr>
<td height="30" width="10%"><div align="center"> </td>
<td height="30" width="16%"><div align="center"> </td>
<td>
</td><td>
</td></tr>
</table>
<p align="center">
<input type="button" name="Submit" value="开始发送" onclick="checksubmit()">
<input type="reset" name="retur" value="清 除">
<input type="button" name="retur1" value="返 回" onclick="window.location='SmsShow.asp'"></p>
</td>
</tr>
<tr><td> </td></tr>
</table>
<table border="0" width="100%">
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%" class="font1">
<p align="center"><br>
<%=GetCompanyRight(aa)%></td>
</tr>
</table>
<%end if%> </body>
</form>
</html>
<!--#include file="..\dblink\closesqlserver.inc"-->
<select size=5 style="width:375px;" name=ReceMobNo ondblclick="alert('OK')" multiple>
<option vlaue="">
</select>
你的select_pc会不会是包含在别的文件里啊?
你的页面里有两个或两个以上的select_pc(即name=select_pc的对象)