Hundred Treasure Box (ii)

Source: Internet
Author: User
Tags error handling header servervariables server port
18. Web pages are not cached
HTM Web page
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache,

Must-revalidate ">
<meta http-equiv= "Expires" content= "Wed, Feb 1997

08:21:57 GMT ">
or <meta http-equiv= "expires" content= "0" >
ASP Web page
Response.Expires =-1
Response.ExpiresAbsolute = Now ()-1
Response.CacheControl = "No-cache"
PHP Web page
Header ("Expires:mon, June June 1997 05:00:00 GMT");
Header ("Cache-control:no-cache, must-revalidate");
Header ("Pragma:no-cache");

19. Check whether a string of strings is all composed of numbers
<script language= "Javascript" ><!--
function Checknum (str) {return Str.match (/\d/) ==null}
Alert (Checknum ("1232142141"))
Alert (Checknum ("123214214A1"))
--></script>

20. Get the size of a window
Document.body.clientwidth,document.body.clientheight

21. How to judge whether it is a character
if (/[^\x00-\xff]/g.test (s)) alert ("contains Chinese characters");
else alert ("All characters");

22.TEXTAREA the number of adaptive lines of text
<textarea Rows=1 name=s1 cols=27

Onpropertychange= "This.style.posheight=this.scrollheight" >
</textarea>

23. Date minus days equals second date
<script language=javascript>
function cc (DD,DADD)
{
You can add error handling
var a = new Date (DD)
A = A.valueof ()
A = A-dadd * 24 * 60 * 60 * 1000
A = new Date (a)
Alert (a.getfullyear () + "year" + (A.getmonth () + 1) + "month" +

A.getdate () + "Day")
}
CC ("12/23/2002", 2)
</script>

24. Which radio was chosen
function Checkme ()
For each OB in Radio1
If ob.checked then Window.alert ob.value
Next
End Function
</script><BODY>
<input name= "Radio1" type= "Radio" value= "style"

Checked>style
<input name= "Radio1" type= "Radio" value= "barcode" >barcode
<input type= "button" value= "Check" onclick= "Checkme ()" >
</BODY></HTML>

25. Get the Request.ServerVariables ("") collection of the URL on this page
Response.Write "<table border=1><!--TABLE Header

--><tr><td><b>variables</b></td><td><b>value</b></td> </TR> "
For each OB in Request.ServerVariables
Response.Write

"<TR><TD>" &ob& "</TD><TD>" &request.servervariables (OB) & "</TD>"

</TR> "
Next
Response.Write "</TABLE>"

26.
Native Ip<%=request.servervariables ("REMOTE_ADDR")%>
Server name <%=request.servervariables ("SERVER_NAME")%>
Server Ip<%=request.servervariables ("local_addr")%>
Server Port <%=request.servervariables ("Server_port")%>
Server Time <%=now%>
IIS version <%=request.servervariables "Server_software")%>
Script Timeout Time <%=Server.ScriptTimeout%>
This file path

<%=server.mappath (Request.ServerVariables ("Script_name"))%>
Number of server CPUs

<%=request.servervariables ("Number_of_processors")%>
Server Interpretation engine <%=scriptengine & "/" &

ScriptEngineMajorVersion & "." &ScriptEngineMinorVersion& "." &

ScriptEngineBuildVersion%>
Server operating system <%=request.servervariables ("OS")%>

The 27.ENTER key allows the cursor to move to the next input box
<input onkeydown= "if (event.keycode==13) event.keycode=9" >

28. Detect the link speed of a website:
Add the following code to the <body> area:
<script language=javascript>
Tim=1
SetInterval ("tim++", 100)
B=1

var autourl=new Array ()
autourl[1]= "Www.njcatv.net"
autourl[2]= "Javacool.3322.net"
autourl[3]= "www.sina.com.cn"
autourl[4]= "www.nuaa.edu.cn"
autourl[5]= "Www.cctv.com"

function Butt () {
document.write ("<form name=autof>")
for (Var i=1;i<autourl.length;i++)
document.write ("<input type=text name=txt" +i+ "size=10"

......> = "<input type=text name=url" +i+ "value= test

= "<input Type=button value=go

Onclick=w



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.