标题:新人救助!
取消只看楼主
无罪的叹息
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-6-23
结帖率:100%
已结贴  问题点数:20 回复次数:1 
新人救助!
上网复制了一段代码,但是运行不了,哪位大哥帮我看看

代码分两部分,一是zb.js这是显示当日值班的,有每个班的值班时间设置,天的整数倍,比如可以一个班值两天才换;二是postzhiban.asp这是后台设置的
以下是zb,js代码:
程序代码:
var now =new Date();var dutyTeam=[];var pastDay=1;var startTime="2011/2/23 8:00:00";
dutyTeam[0]="☆★☆韩旭  凌明钊";
dutyTeam[1]="☆★☆凌强  张落";
dutyTeam[2]="☆★☆李乐意  黄敦伦";
dutyTeam[3]="☆★☆博春前  孙浩";
var loop=Math.floor((now.getTime()-Date.parse(startTime))/(24*60*60*1000*pastDay));
var inx=loop%dutyTeam.length;
var i=4;
document.write(dutyTeam[inx]+"  值班电话  内线:2168  外线:3055632")

以下是postzhiban.asp代码
程序代码:
<script src=/js/zb.js></script>
<div style="margin:0 auto;width:100%"><center>
<form method=POST action=?action=fucnok>


 <div style=height:60px;line-height:60px><b>本页面为值班设置页面</b></div>
<%
dim fso1,openfile,tmpstr,tmp,ad_num,ad_i,ad_tmp
set fso1 = server.createobject("scripting.filesystemobject")
Set openfile=fso1.OpenTextFile(Server.MapPath("/js/zb.js"))
tmpstr=openfile.readall
tmp=split(tmpstr,chr(13)&chr(10))
'取出值班轮次
ad_num=replace(tmp(UBound(tmp)-1),"var i=","")
ad_num=int(replace(ad_num,";",""))
'取出开始时间
starttime=replace(tmp(0),"var now =new Date();var dutyTeam=[];var pastDay=1;var startTime=""","")
starttime=replace(starttime,""";","")
'取出联系方式
lianxi=replace(tmp(UBound(tmp)),"document.write(dutyTeam[inx]+""  值班电话  ","")
lianxi=replace(lianxi,""")","")
'显示值班相关内容以便修改
response.write"<div><span style=width:170px>开始时间</span><textarea  rows=1 cols=30 name=starttime style='font-family: 宋体; font-size: 10pt'>"&starttime&"</textarea></div>"
response.write"<div><span style=width:170px>联系方式</span><textarea  rows=1 cols=30 name=lianxi style='font-family: 宋体; font-size: 10pt'>"&lianxi&"</textarea></div>"
for ad_i=1 to ad_num
ad_tmp=replace(tmp(ad_i),"dutyTeam["&ad_i-1&"]=""☆★☆","")
ad_tmp=replace(ad_tmp,""";","")
response.write"<div><span style=width:170px>"&ad_i&"</span><textarea  rows=1 cols=30 name=ad_v"&ad_i&" style='font-family: 宋体; font-size: 10pt'>"&ad_tmp&"</textarea></div>"
server.scripttimeout=5 
next
openfile.close
set fso1=nothing
%>  

 <div><span style=width:170px>增加值班班次</span><textarea rows=1 cols=30 name=ad_v<%=ad_num+1%> rows="2" style="font-family: 宋体; font-size: 10pt"></textarea></div>
   <div>
   <input type="submit" value="  确  认  修  改  " name="B1"></div>
</form>

<%
if Request("action")="fucnok" then
dim adv_num,ad_msg
set fso1 = server.createobject("scripting.filesystemobject")
Set openfile=fso1.OpenTextFile(Server.MapPath("/js/zb.js"))
tmpstr=openfile.readall
tmp=split(tmpstr,chr(13)&chr(10))
'取出值班轮次
ad_num=replace(tmp(UBound(tmp)-1),"var i=","")
ad_num=int(replace(ad_num,";",""))
openfile.close
set fso1=nothing
adv_num=0
ad_msg="var now =new Date();var dutyTeam=[];var pastDay=1;"&"var startTime="""&request.form("starttime")&""";"&vbcrlf
for ad_i=1 to ad_num+1
ad_tmp=replace(request.form("ad_v"&ad_i&""),"'","")
ad_tmp=replace(ad_tmp,chr(13)&chr(10),"")
if trim(ad_tmp)<>"" or isnull(ad_tmp)then
adv_num=adv_num+1
ad_msg=ad_msg&"dutyTeam["&adv_num-1&"]=""☆★☆"&ad_tmp&""";"&vbcrlf
end if
next
ad_msg=ad_msg&"var loop=Math.floor((now.getTime()-Date.parse(startTime))/(24*60*60*1000*pastDay));"&vbcrlf
ad_msg=ad_msg&"var inx=loop%dutyTeam.length;"&vbcrlf
ad_msg=ad_msg&"var i="&adv_num&";"&vbcrlf
ad_msg=ad_msg&"document.write(dutyTeam[inx]+""  值班电话  "
ad_msg=ad_msg&request.form("lianxi")&""")"
dim objFSO,objname
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objname=objFSO.CreateTextFile(Server.MapPath("/js/zb.js"),True)
objname.Write ad_msg
objname.close
set objfso=nothing
response.redirect"Postzhiban.Asp"
end if
%> 



错误提示:

Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: '[string: "document.write(dutyT"]'

/postzhiban.asp,行 14
搜索更多相关主题的帖子: 大哥 上网 js代码 
2012-02-01 10:37
无罪的叹息
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-6-23
得分:0 
谢谢版主!但是改了还是显示原来的错误啊!
2012-02-02 15:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-360224-1-1.html




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

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