var tt,tt1
for (i=1;i<=3;i++)
{
tt1=eval("document.form1.tp"+i);
tt=eval("document.form1.fj"+i);
if (killspace(tt.value)!="")
{
tt1.value="1";
}
else
{
tt1.value="0";
}
}
<td height="30" colspan="2" align="center">
<input type="hidden" name="tp1" value="0">
<input type="hidden" name="tp2" value="0">
<input type="hidden" name="tp3" value="0">
<input type="hidden" name="lb" value="<%=lb1%>">
<input name="Submit2" type="submit" value="发新话题">
for (i=1;i<=3;i++)
{
tt1=eval("document.form1.tp"+i);
tt=eval("document.form1.fj"+i);
if (killspace(tt.value)!="")
{
tt1.value="1";
}
else
{
tt1.value="0";
}
}
<td height="30" colspan="2" align="center">
<input type="hidden" name="tp1" value="0">
<input type="hidden" name="tp2" value="0">
<input type="hidden" name="tp3" value="0">
<input type="hidden" name="lb" value="<%=lb1%>">
<input name="Submit2" type="submit" value="发新话题">
解决方案 »
- 初学JQUERY框架,基础问题
- 针对listbox,客户端可以手动排序,listbox第一列为固定的序号列,不参与手动排序,手动排序为上下按钮,可以针对选中的Item进行排序,该怎么做呢?
- 关于两个html文件传递参数的问题,js高手进来下哦!
- 如何将IE的边框全部去掉???
- 老说document.getElementByle();有错误(急救帮忙下)
- 一个很麻烦的问题?????
- 如何用JavaScript判断客户端浏览器是否安装了Flash插件,及其版本?(flyonet请进)
- 怎样定位层,在800*600上的位置和1024*768上位置保持一致
- 请教一个问题,请大家帮帮忙。
- 在调用打印时的问题?
- 关于弹出类似qq提示信息的代码修改
- JS如何验证输入的是中文?
<!--#include file="conn.asp"-->
<!--#include FILE="upLoad.asp"-->
<%dim request2,formPath,formName,intCount,intTemp
set request2=new UpLoadClass
request2.AutoSave=2
request2.MaxSize = 307200'单文件最大300k
request2.FileType="gif/jpg/png/bmp/doc/rar/chm/txt"
request2.SavePath="pic/"
request2.open()
function chkstring(string)
if string="" then string=" "
chkstring=replace(string,"'","''")
end function
lb1=request2.Form("lb")
bt=trim(request2.Form("bt"))
tb=trim(request2.Form("tb"))
lr=trim(request2.Form("lr"))
xh=request2.Form("xh")
if xh="" then xh=0
msg1=1
intCount=0
for i=1 to Ubound(request2.FileItem)
formName=request2.FileItem(i)
if request2.Form("tp"&i)=1 then
select case request2.form(formName&"_Err")
case -1:
msg="没有文件上传!!"
msg1=0
exit for
case 0:
intCount=intCount+1
msg1=2
case 1:
msg="文件太大,拒绝上传!!"
msg1=0
exit for
case 2:
msg="文件格式不对,拒绝上传!!"
msg1=0
exit for
case 3:
msg="文件太大且格式不对,拒绝上传!!"
msg1=0
exit for
end select
end if
next
if msg1>=1 then
sql3="select top 1 lb_zhhfrq,lb_jfts from lb where lb_id="&lb1&""
set rs=conn.execute(sql3)
rq=rs(0)
ts=rs(1)
if now>=datevalue(rq)+1 then
jfts=1
else
jfts=rs(1)+1
end if
rs.close
sql="insert into [fb](fb_lb,fb_yh,fb_yhid,fb_bt,fb_tb,fb_lr,fb_xh,fb_rq,fb_fj,fb_zhhfr,fb_zhhfrid,fb_zhhfrq) values "
sql=sql&"("&lb1&",'"&session("yh")&"',"&session("yhid")&",'"&bt&"','"&tb&"','"&lr&"',"&xh&",'"&now&"',"&intCount&", "
sql=sql&"'"&session("yh")&"',"&session("yhid")&",'"&now&"' )"
conn.execute(sql)
sql5="select top 1 fb_id,fb_rq from [fb] where fb_lb="&lb1&" order by fb_id desc "
set rs=conn.execute(sql5)
rq1=rs(1)
ztid=rs(0)
rs.close
set rs=nothing
sql2="update [lb] set lb_zts=lb_zts+1,lb_fts=lb_fts+1,lb_jfts="&jfts&",lb_zhhfzt='"&bt&"', "
sql2=sql2&"lb_zhhfrq='"&rq1&"',lb_zhhfr='"&session("yh")&"',lb_zhhfrid="&session("yhid")&" where lb_id="&lb1&""
conn.execute(sql2)
sql4="update [yh] set yh_fts=yh_fts+1,yh_zhfbrq='"&rq1&"',yh_jf=yh_jf+1 where yh_id="&session("yhid")&" "
conn.execute(sql4)
sql5="update fb set fb_ztid="&ztid&" where fb_id="&ztid&""
conn.execute(sql5)
if msg1=2 then
for i=1 to Ubound(request2.FileItem)
formName=request2.FileItem(i)
if request2.Save(formName,0) then
size=request2.form(formName&"_size")
lx=request2.form(formName&"_Ext")
dz=request2.form(formName)
mc=request2.form(formName&"_name")
sql1="insert into [fj](fj_fbid,fj_lb,fj_yh,fj_yhid,fj_size,fj_mc,fj_dz,fj_lx,fj_rq) values "
sql1=sql1&"("&ztid&","&lb1&",'"&session("yh")&"',"&session("yhid")&","&size&",'"&mc&"','"&dz&"','"&lx&"','"&now&"')"
conn.execute(sql1)
end if
next
end if
set conn=nothing
set request2=nothing
end if
if msg1>=1 then
msg="<li><b>主题已经发表成功</b><li>三秒自动返回主题<li><a href=diszt.asp?tid="&ztid&">返回主题</a>"
msg=msg&"<script>window.tm = setInterval(""location.href='diszt.asp?tid="&ztid&"'"", 1000)</script>"
else
msg="<li><b>"&msg&"</b><li><a href='javascript:history.back()'>[点击这里返回前页]</a>"
end if %>
Private objForm,binForm,binItem,strDate,lngTime
Public FormItem,FileItem Public Property Get Version
Version="Rumor UpLoadClass Version 2.0"
End Property Public Property Get Error
Error=p_Error
End Property Public Property Get MaxSize
MaxSize=p_MaxSize
End Property
Public Property Let MaxSize(lngSize)
if isNumeric(lngSize) then
p_MaxSize=clng(lngSize)
end if
End Property Public Property Get FileType
FileType=p_FileType
End Property
Public Property Let FileType(strType)
p_FileType=strType
End Property Public Property Get SavePath
SavePath=p_SavePath
End Property
Public Property Let SavePath(strPath)
p_SavePath=replace(strPath,chr(0),"")
End Property Public Property Get AutoSave
AutoSave=p_AutoSave
End Property
Public Property Let AutoSave(byVal Flag)
select case Flag
case 0:
case 1:
case 2:
case false:Flag=2
case else:Flag=0
end select
p_AutoSave=Flag
End Property Private Sub Class_Initialize
p_Error = -1
p_MaxSize = 153600
p_FileType = "jpg/gif"
p_SavePath = ""
p_AutoSave = 0
strDate = replace(cstr(Date()),"-","")
lngTime = clng(timer()*1000)
Set binForm = Server.CreateObject("ADODB.Stream")
Set binItem = Server.CreateObject("ADODB.Stream")
Set objForm = Server.CreateObject("Scripting.Dictionary")
objForm.CompareMode = 1
End Sub Private Sub Class_Terminate
objForm.RemoveAll
Set objForm = nothing
Set binItem = nothing
binForm.Close()
Set binForm = nothing
End Sub Public Sub Open()
if p_Error=-1 then
p_Error=0
else
Exit Sub
end if
Dim lngRequestSize,binRequestData,strFormItem,strFileItem
Const strSplit="'"">"
lngRequestSize=Request.TotalBytes
if lngRequestSize<1 then
p_Error=4
Exit Sub
end if
binRequestData=Request.BinaryRead(lngRequestSize)
binForm.Type = 1
binForm.Open
binForm.Write binRequestData Dim bCrLf,strSeparator,intSeparator
bCrLf=ChrB(13)&ChrB(10) intSeparator=InstrB(1,binRequestData,bCrLf)-1
strSeparator=LeftB(binRequestData,intSeparator) Dim p_start,p_end,strItem,strInam,intTemp,strTemp
Dim strFtyp,strFnam,strFext,lngFsiz
p_start=intSeparator+2
Do
p_end =InStrB(p_start,binRequestData,bCrLf&bCrLf)+3
binItem.Type=1
binItem.Open
binForm.Position=p_start
binForm.CopyTo binItem,p_end-p_start
binItem.Position=0
binItem.Type=2
binItem.Charset="gb2312"
strItem=binItem.ReadText
binItem.Close() p_start=p_end
p_end =InStrB(p_start,binRequestData,strSeparator)-1
binItem.Type=1
binItem.Open
binForm.Position=p_start
lngFsiz=p_end-p_start-2
binForm.CopyTo binItem,lngFsiz intTemp=Instr(39,strItem,"""")
strInam=Mid(strItem,39,intTemp-39) if Instr(intTemp,strItem,"filename=""")<>0 then
if not objForm.Exists(strInam&"_From") then
strFileItem=strFileItem&strSplit&strInam
if binItem.Size<>0 then
intTemp=intTemp+13
strFtyp=Mid(strItem,Instr(intTemp,strItem,"Content-Type: ")+14)
strTemp=Mid(strItem,intTemp,Instr(intTemp,strItem,"""")-intTemp)
intTemp=InstrRev(strTemp,"\")
strFnam=Mid(strTemp,intTemp+1)
objForm.Add strInam&"_Type",strFtyp
objForm.Add strInam&"_Name",strFnam
objForm.Add strInam&"_Path",Left(strTemp,intTemp)
objForm.Add strInam&"_Size",lngFsiz
if Instr(intTemp,strTemp,".")<>0 then
strFext=Mid(strTemp,InstrRev(strTemp,".")+1)
else
strFext=""
end if
if left(strFtyp,6)="image/" then
binItem.Position=0
binItem.Type=1
strTemp=binItem.read(10)
if strcomp(strTemp,chrb(255) & chrb(216) & chrb(255) & chrb(224) & chrb(0) & chrb(16) & chrb(74) & chrb(70) & chrb(73) & chrb(70),0)=0 then
if Lcase(strFext)<>"jpg" then strFext="jpg"
binItem.Position=3
do while not binItem.EOS
do
intTemp = ascb(binItem.Read(1))
loop while intTemp = 255 and not binItem.EOS
if intTemp < 192 or intTemp > 195 then
binItem.read(Bin2Val(binItem.Read(2))-2)
else
Exit do
end if
do
intTemp = ascb(binItem.Read(1))
loop while intTemp < 255 and not binItem.EOS
loop
binItem.Read(3)
objForm.Add strInam&"_Height",Bin2Val(binItem.Read(2))
objForm.Add strInam&"_Width",Bin2Val(binItem.Read(2))
elseif strcomp(leftB(strTemp,8),chrb(137) & chrb(80) & chrb(78) & chrb(71) & chrb(13) & chrb(10) & chrb(26) & chrb(10),0)=0 then
if Lcase(strFext)<>"png" then strFext="png"
binItem.Position=18
objForm.Add strInam&"_Width",Bin2Val(binItem.Read(2))
binItem.Read(2)
objForm.Add strInam&"_Height",Bin2Val(binItem.Read(2))
elseif strcomp(leftB(strTemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(57) & chrb(97),0)=0 or strcomp(leftB(strTemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(55) & chrb(97),0)=0 then
if Lcase(strFext)<>"gif" then strFext="gif"
binItem.Position=6
objForm.Add strInam&"_Width",BinVal2(binItem.Read(2))
objForm.Add strInam&"_Height",BinVal2(binItem.Read(2))
elseif strcomp(leftB(strTemp,2),chrb(66) & chrb(77),0)=0 then
if Lcase(strFext)<>"bmp" then strFext="bmp"
binItem.Position=18
objForm.Add strInam&"_Width",BinVal2(binItem.Read(4))
objForm.Add strInam&"_Height",BinVal2(binItem.Read(4))
end if
end if
objForm.Add strInam&"_Ext",strFext
objForm.Add strInam&"_From",p_start
intTemp=GetFerr(lngFsiz,strFext)
'if p_AutoSave<>2 then
if p_AutoSave=2 then
objForm.Add strInam&"_Err",intTemp
if intTemp=0 then
if p_AutoSave=0 then
strFnam=GetTimeStr()
if strFext<>"" then strFnam=strFnam&"."&strFext
end if
'binItem.SaveToFile Server.MapPath(p_SavePath&strFnam),2
'objForm.Add strInam,strFnam
end if
end if
else
objForm.Add strInam&"_Err",-1
end if
end if
else
binItem.Position=0
binItem.Type=2
binItem.Charset="gb2312"
strTemp=binItem.ReadText
if objForm.Exists(strInam) then
objForm(strInam) = objForm(strInam)&","&strTemp
else
strFormItem=strFormItem&strSplit&strInam
objForm.Add strInam,strTemp
end if
end if