Some common methods of javascript scripts that have just been found on the Internet.
1. oncontextmenu = "window. event. returnvalue = false" will completely block the right mouse button
<Table border oncontextmenu = return (false)> <td> no </table>
<Script language = "javascript"> <! --
If (window = top) top. location. href = "frames.htm"; // frames.htm is the frame webpage.
// --> </Script>
<Script language = javascript> <! --
If (top. location! = Self. location) top. location = self. location;
// --> </SCRIPT>
"<Noscript> <iframe> onclick =" window. location = 'view-source: '+ 'HTTP: // www.csdn.net/' ">
<% If Request. ServerVariables ("HTTP_X_FORWARDED_FOR") <> "then
Response. write "<font color = # FF0000> you have passed the proxy server ,"&_
"The real IP address is" & Request. ServerVariables ("HTTP_X_FORWARDED_FOR ")
End if
%>
<Script language = "javascript">
Function getIE (e ){
Var t = e. offsetTop;
Var l = e. offsetLeft;
While (e = e. offsetParent ){
T + = e. offsetTop;
L + = e. offsetLeft;
}
Alert ("top =" + t + "\ nleft =" + l );
}
</Script>
<Script language = "VBScript"> <! --
Function getIE ()
Dim t, l, a, B
Set a = document. all. img1
T = document. all. img1.offsetTop
L = document. all. img1.offsetLeft
While a. tagName <> "BODY"
Set a = a. offsetParent
T = t + a. offsetTop
L = l + a. offsetLeft
Wend
Msgbox "top =" & t & chr (13) & "left =" & l, 64, "Get control position"
End function
--> </Script>
<Script language = "javascript">
Function cc ()
{
Var e = event. srcElement;
Var r = e. createTextRange ();
R. moveStart ('character ', e. value. length );
R. collapse (true );
R. select ();
}
</Script>
<Input type = text value = "123">
Asp:
Request. servervariables ("HTTP_REFERER ")
Document. referrer
<Object classid = "clsid: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param value = "Minimize"> </object>
<Object classid = "clsid: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param value = "Maximize"> </object>
<OBJECT classid = "clsid: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM value = "Close"> </OBJECT>
<Input type = button value = maximized
<Input type = button value = disabled
This example applies to IE
<%
'Define some constants for database connection
Const adOpenForwardOnly = 0' the cursor only browses records forward. pagination, Recordset, and BookMark are not supported.
Const adOpenKeyset = 1' indicates the keyset cursor. modifications made by other users to the record are reflected in the record set. However, adding or deleting records by other users is not reflected in the record set. Supports paging, Recordset, and BookMark
Const adOpenDynamic = 2' the most dynamic cursor function, but the most resource consumption. The added or deleted records modified by the user on the record description will be reflected in the record set. Supports full-featured browsing (ACCESS is not supported ).
Const adOpenStatic = 3' the static cursor is only a snapshot of the data. The changes you make to the record description, adding or deleting records, will not be reflected in the record set. Supports moving forward or backward
Const adLockOptimistic = 3' the record set is locked only when the Update method is called, and other operations before this can still change, insert, and delete the current record.
Const adLockBatchOptimistic = 4' records are not locked when being edited, but changes, inserts, and deletes are completed in the batch processing mode.
Const adCmdTable = & H0002
%>
HTM webpage
<META HTTP-EQUIV = "pragma" CONTENT = "no-cache">
<META HTTP-EQUIV = "Cache-Control" CONTENT = "no-cache, must-revalidate">
<META HTTP-EQUIV = "expires" CONTENT = "Wed, 26 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 webpage
Header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("Pragma: no-cache ");
<Input type = text style = "border: 1 solid #000000">
Or
<Input type = text style = "border-left: none; border-right: none; border-top: none; border-bottom: 1 solid #000000"> </textarea>
<Div> (division) is used to define the page elements of a large segment, and a line is generated.
<Span> is used to define elements in the same row. The only difference between <div> and <div> is that no transpose is generated.
<Layer> is the ns tag, which is not supported by ie, which is equivalent to <div>
<Body>
Make the vertical bar not:
<Body style = 'overflow: scroll; overflow-y: Den den '>
</Body>
Make the horizontal bar unavailable:
<Body style = 'overflow: scroll; overflow-x: Den den '>
</Body>
Remove both of them? Simpler
<Body scroll = "no">
</Body>
<A href = "#"> </a>
<Form method = "post" action = "mailto: ***** @ ***. com" enctype = "text/plain">
<Input type = submit>
</Form>
Windows. opener. location. reload ()
<Body>
<Html> <Style>
Body
{Background-image: url(logo.gif); background-repeat: no-repeat; background -}
</Style>
</Head>
<Body bgproperties = "fixed">
</Body>
</Html>
<Script language = "javascript"> <! --
Function checkNum (str) {return str. match (/\ D/) = null}
Alert (checkNum ("1232142141 "))
Alert (checkNum ("123214214a1 "))
// --> </Script>
Document. body. clientWidth, document. body. clientHeight
If (/[^ \ x00-\ xff]/g. test (s) alert ("containing Chinese characters ");
Else alert ("All characters ");
<Textarea rows = 1 cols = 27 onpropertychange = "this. style. posHeight = this. scrollHeight">
</Textarea>
<Script language = javascript>
Function cc (dd, dadd)
{
// Add error handling.
Var a = new Date (dd)
A = a. valueOf ()
A = a-dadd * 24x60*60*1000
A = new Date ()
Alert (a. getFullYear () + "year" + (a. getMonth () + 1) + "month" + a. getDate () + "day ")
}
Cc ("12/23/2002", 2)
</Script>
<HTML> <script language = "vbscript">
Function checkme ()
For each ob in radio1
If ob. checked then window. alert ob. value
Next
End function
</Script> <BODY>
<INPUT type = "radio" value = "style" checked> style
<INPUT type = "radio" value = "barcode"> Barcode
<INPUT type = "button" value = "check">
</BODY> </HTML>
For each ob in Request. ServerVariables
Response. write "<TR> <TD>" & ob & "</TD> <TD>" & Request. serverVariables (ob) & "</TD> </TR>"
Next
Response. Write "</TABLE>"
Local ip address <% = 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 <% = Server. ScriptTimeout %>
Path of this file <% = server. mappath (Request. ServerVariables ("SCRIPT_NAME") %>
Server CPU count <% = Request. ServerVariables ("NUMBER_OF_PROCESSORS") %>
Server interpretation engine <% = ScriptEngine & "/" & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion %>
Server Operating System <% = Request. ServerVariables ("OS") %>
<Input>
Add the following code to the <body> area:
<Script language = javascript>
Tim = 1
SetInterval ("tim + +", 100)
B = 1
Autourl [1] = "http://www.njcatv.net "/
Autourl [2] = "javacool.3322.net"
Autourl [3] = "http://www.sina.com.cn "/
Autourl [4] = "http://www.nuaa.edu.cn "/
Autourl [5] = "http://www.cctv.com "/
Documents. write ("<form)
For (var I = 1; I <autourl. length; I ++)
Documents. write ("<input type = text + I +" size = 10 value = testing...> = "<Input type = text + I +" size = 40 >=" <input type = button value = GO + I + ". value)> <br> ")
Documents. write ("<input type = submit value = Refresh> </form> ")
}
Butt ()
Function auto (url ){
Document. forms [0] ["url" + B]. value = url
If (tim> 200)
{Document. forms [0] ["txt" + B]. value = "link timeout "}
Else
{Document. forms [0] ["txt" + B]. value = "time" + tim/10 + "second "}
B ++
}
Function run () {for (var I = 1; I <autourl. length; I ++) documents. write (" ")}
Run () </script>
Auto: Standard cursor
Default: Standard arrow
Hand: hand-shaped cursor
Wait: waiting for the cursor
Text: I-shaped cursor
Vertical-text: horizontal I-shaped cursor
No-drop: Do not drag the cursor
Not-allowed: Invalid cursor
Help :? Help cursor
All-scroll: triangle direction indicator
Move: move mark
Crosshair: Cross logo
E-resize
N-resize
Nw-resize
W-resize
S-resize
Se-resize
Sw-resize