2.修改contentType并下载gif等格式
<%
functiondl(f,n)
onerrorresumenext
sets=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
s.LoadFromFile(server.mappath(f))
iferr.number>0then
response.writeerr.number&":"&err.description
else
response.contentType="application/x-gzip"
response.addheader"Content-Disposition:","attachment;filename="&n
response.binarywrite(s.Read(s.size))
endif
endfunction
calldl("012922501.gif","t1.gif")
%>
19.检查一段字符串是否全由数字组成
<scriptlanguage="javascript"><!--
functioncheckNum(str)...{return!/D/.test(str)}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
//--></script>
20.获得一个窗口的大小
document.body.clientWidth,document.body.clientHeight
document.body.offsetWidth,document.body.offsetHeight
有时还需要知道window.screenTop,window.screenLeft
21.怎么判断是否含有汉字
if(escape(str).indexOf("%u")!=-1)alert("含有汉字");
elsealert("全是字符");
22.TEXTAREA自适应文字行数的多少
IE5.5+可以用overflow-y:visible
<textarearows=1name=s1cols=27style="overflow-y:visible">
</textarea>
23.日期减去天数等于第二个日期
<scriptlanguage=javascript>
function cc(dd,dadd)
...{
//可以加上错误处理
vard=newDate(dd.replace("-","https://www.jb51.net/"))
d.setDate(d.getDate()+dadd)
alert(d.getFullYear()+"年"+(d.getMonth()+1)+"月"+d.getDate()+"日")
}
cc("2002-2-28",2)
</script>
您可能感兴趣的文章: