Common javascript skills

Source: Internet
Author: User
Tags get ip html encode servervariables
Common javascript skills

If the content exceeds the cell, it is hidden.
Style = "TABLE-LAYOUT: fixed"

Make the pop-up window always at the top: <body onblur = "this. focus ();">
Do not scroll bars? Make the vertical bar not: <body style = 'overflow: scroll; overflow-y: Den den '> </body>
Make the horizontal bar not: <body style = 'overflow: scroll; overflow-x: Den den '> </body>
Remove both of them? Simpler <body scroll = "no"> </body>
How can I remove the dotted line around the image after clicking the image link? <A href = "#" onFocus = "this. blur ()"> </a>
Email processing submission form <form name = "form1" method = "post" action = "mailto :****@***. com "enctype =" text/plain "> <input type = submit> </form>
In the opening Child Window, how does one refresh the code of the parent window? Window. opener. location. reload ()
How to set the page size <body onload = "top. resizeTo (300,200);">
How to add a background image that is not full? When pulling the page, the background image does not move

Various styles of cursor 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 Label e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize

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") %>

Text vertical layout
<Style type = "text/css">
<! --
. Shupai {Writing-mode: tb-rl}
-->
</Style>
Move the hyperlink to the dotted border
Add onfocus = "this. blur ()" to the link ()"

Insert a keyword in the Webpage Search Header
<Meta name = "keywords" CONTENT = "xxxx, xxxx, xxx, xxxxx, xxxx,">

Favorites icon
<Link rel = "Shortcut Icon" href = "favicon. ico">

My computer
File: // ::{ 20D04FE0-3AEA-1069-A2D8-08002B30309D}
Network neighbors
File: //: % 7B208D2C60-3AEA-1069-A2D7-08002B30309D % 7D
My Documents
File: //: % 7B450D8FBA-AD25-11D0-98A8-0800361B1103% 7D
Control Panel
File: //: {20D04FE0-3AEA-1069-A2D8-08002B30309D}/: {21EC2020-3AEA-1069-A2DD-08002B30309D}
Recycle Bin
File: //: % 7B645FF040-5081-101B-9F08-00AA002F954E % 7D

Control the image hiding effect with the mouse
Add the following code to the <body> area:
<SCRIPT language = "javascript">
<! --
Function makevisible (cur, which ){
If (which = 0)
Cur. filters. alpha. opacity = 100
Else
Cur. filters. alpha. opacity = 20
}
// -->
</SCRIPT>
2. Add the following code to the <body> area:
OnMouseOver = "makevisible (this, 0 )"
OnMouseOut = "makevisible (this, 1)">

Disable image download
<A href = "javascript: void (0)" onMouseover = "alert ('Sorry, this image cannot be downloaded! ') ">
</A>

Page embedding
<Iframe width = 291 height = 247 src = "main. files/news.htm" frameBorder = 0> </iframe>

Hide a scroll bar
<Body style = "overflow-x: hidden; overflow-y: hidden"

CSS text shadow (defined in <TD>)
. Abc {
FILTER: dropshadow (color = #666666, offx = 1, offy = 1, positive = 1); FONT-FAMILY: ""; FONT-SIZE: 9pt; COLOR: # ffffff;
}

LIST/menu
Onchange = "location = this. options [this. selectedIndex]. value"

<Iframe id = "frm" src = "k-xinwen.html" scrolling = "no" width = "314" height = "179"> </iframe>

Reurl=server.html encode (request. ServerVariables ("HTTP_REFERER "))

How to define connections on the server
MM_www_STRING = "driver = {Microsoft access Driver (*. mdb)}; dbq =" & server. mappath ("../data/www. mdb ")

Link
Response. redirect "login. asp"
Location. href = "xx. asp"

OnClick = "window. location = 'login. asp '"
OnClick = "window. open ('')"

Get IP
Userip = Request. ServerVariables ("HTTP_X_FORWARDED_FOR ")
If userip = "" Then userip = Request. ServerVariables ("REMOTE_ADDR ")

SQL = "update feedbak set hit = hit + 1 where id =" & request ("id ")
Conn.exe cute (SQL)

Whether to add the truncation character...
Function formatStr (str, len)
If (len (str)> len)
Str = left (str, len) + "..."
End if
FormatStr = str
End function

Receiving form
If Ucase (Request. ServerVariables ("REQUEST_METHOD") = "POST" then
End if

Image Width
<Script language = "javascript">
<! --
Var flag = false;
Function DrawImage (ckp ){
Var image = new Image ();
Image. src = ckp. src;
If (image. width> 0 & image. height> 0)
{Flag = true;
If (image. width> 120 ){
Ckp. width = 120;
} Else {
Ckp. width = image. width;
}
Ckp. alt = image. width + "×" + image. height;
}
}
// -->
</Script>
'I will be Back 22:18:06
/<% = rs (" photoname ") %>" border = "0" onload = "javascript: DrawImage (this ); ">

Jump
<Meta http-equiv = refresh content = '0; url =/distributor. aspx '>

Overflow bar settings
Visible: the excess parts are displayed;
Hidden: Hide the excess parts;
Scrool: the scroll bar is displayed no matter whether it exceeds the limit;
Auto: the scroll bar is displayed only when the value exceeds the upper limit;

OnMouseOver: move the mouse over the target;
OnMouseUp: When you press the mouse and then open the left button;
OnMouseOut: When the mouse is removed;
OnMouseDown: When you press the mouse (you do not need to open the left button );
OnClink: click it;
OnDblClick: Double-click;
OnLoad: when loading a webpage;
OnUnload: When the page is left;
OnResize: When the browser changes the browsing window size;
OnScroll: When the viewer drags the scroll bar.

CSS style
A: link: the link has been connected;
A: hover: indicates moving the link over the mouse;
A: active: indicates that the link is activated;
A: visited: indicates the link you have clicked.

Pop-up dialog box Link
Javascript: alert ('lajflsjpjwg ')
Back: javascript: history. back (1)
Close window: javascript: window. close ();
Restore window
Function restore (){
Window. moveTo (8, 8 );
Window. resizeTo (screen. width-24, screen. availHeight-24 );
}

The head area refers to the content between Tags that must be added

1. Company copyright note
<! --- The site is designed by Maketown, Inc 06/2000 --->

2. webpage display character set
<META HTTP-EQUIV = "Content-Type" CONTENT = "text/html; charset = gb2312">
Traditional Chinese: <META HTTP-EQUIV = "Content-Type" CONTENT = "text/html; charset = BIG5">
English: <META HTTP-EQUIV = "Content-Type" CONTENT = "text/html; charset = iso-8859-1">

3. webpage producer Information
<META name = "author" content = "webmaster@maketown.com">

4. Website Introduction
<Meta name = "DESCRIPTION" CONTENT = "xxxxxxxxxxxxxxxxxxxxxxxx">

5. Search for keywords
<Meta name = "keywords" CONTENT = "xxxx, xxxx, xxx, xxxxx, xxxx,">

6. css specifications for webpages
<LINK href = "style/style.css" rel = "stylesheet" type = "text/css">
(See directory and naming rules)

7. webpage title
<Title> xxxxxxxxxxxxxxxxxx </title>

. You can select the added tag.

1. Set the expiration time of the webpage. Once the webpage expires, you must re-access it on the server.
<META HTTP-EQUIV = "expires" CONTENT = "Wed, 26 Feb 1997 08:21:57 GMT">

2. Disable the browser from accessing the page content from the cache on the local machine.
<META HTTP-EQUIV = "Pragma" CONTENT = "no-cache">

3. It is used to prevent others from calling your page in the framework.
<META HTTP-EQUIV = "Window-target" CONTENT = "_ top">

4. Automatic jump.
<META HTTP-EQUIV = "Refresh" CONTENT = "5; URL = http://www.yahoo.com">
5 indicates that the time is 5 seconds.

5. The web search robot wizard is used to tell robots which pages need to be indexed and which pages do not need to be indexed.
<Meta name = "robots" CONTENT = "none">
CONTENT parameters include all, none, index, noindex, follow, and nofollow. The default value is all.

6. favorites icon
<Link rel = "Shortcut Icon" href = "favicon. ico">

All javascript calls should adopt external calls as much as possible.
<Script language = "javascript" SRC = "script/xxxxx. js"> </SCRIPT>

Attached <body> label:
<Body> the tag does not belong to the head area. To ensure browser compatibility, you must set the page background. <body bgcolor = "# FFFFFF">

Flash transparency
Add <param name = "wmode" value = "transparent">

Table transparency
Style = "FILTER: alpha (opacity = 72 )"

How to add an icon before a URL
1. UploadHttp://www.favicon.comCreate an icon with its icon editor online. He will send the completed icons to you by email.
2. Place the icon named favicon.icoin the same folder as index.html. You can.
As an icon file, the size is 16*16 pixels. The file extension is ico and then uploaded to the corresponding directory. Add the following code between the HTML source file "<Link Rel = "shortcut icon" href = "http: // image address (corresponding to the directory just now)">
The "SHORTCUT cut ICON" is the name of the ICON. Of course, if you use IE5 or a later version for browsing, it will be simpler. You only need to upload the image to the root directory of the website for automatic identification.

<Link rel = "Bookmark" href = "favicon. ico">

Status Bar Connection description
<A href = "link to somewhere" onmouseOver = "window. status = 'Connection description'; return true; "onMouseOut =" window. status = '';"> XX link </a>

Link Description
<A href = "" Title = Link Description>

Right-click prohibited
Add <body oncontextmenu = "return false"> to the <body> label.

Enter space in DW
Insert N & nbsp;

Horizontal line
<Hr width = "length" size = "height" color = "color code" noshade> noshade indicates whether shadow exists.

Form email submission
<Form name = "content" method = "post" action = "mailto: email"> </form>
The text domain name is Subject as the mail title

Custom Email links
Mailto: address? Subject = Email Title & bc = CC & bcc = bcc

Background Music
<Bgsound src = address loop = "-1">

Disable page Body Selection
<Body oncontextmenu = "return false" ondragstart = "return false" onselectstart = "return false" onselect = "document. selection. empty () "oncopy =" document. selection. empty () "onbeforecopy =" return false "onmouseup =" document. selection. empty () ">

Remove the image toolbar that automatically appears in ie6 and set the GALLERYIMG attribute to false or no.

When you click an empty link, the page is often reset to the top.
The Code "javascript: void (null)" replaces the original "#" mark

How to prevent others from placing your webpage in the framework
<Script language = "javascript"> <! -- If (self! = Top) {top. location = self. location;} --> </script>

Page timed refresh
<Meta http-equiv = "Refresh" content = "seconds">

The page is switched to a new address at regular intervals.
<Meta http-equiv = "refresh" content = "seconds; URL = url">

Display date
<Script language = "javascript"> <! --
Today = new Date ();
Var week; var date;
If (today. getDay () = 0) week = "Sunday"
If (today. getDay () = 1) week = "Monday"
If (today. getDay () = 2) week = "Tuesday"
If (today. getDay () = 3) week = "Wednesday"
If (today. getDay () = 4) week = "Thursday"
If (today. getDay () = 5) week = "Friday"
If (today. getDay () = 6) week = "Saturday"
Date = (today. getYear () + "year" + (today. getMonth () + 1) + "month" + today. getDate () + "day" + ""
Document. write ("<span style = 'font-size: 9pt; '>" + date + week + "</span> ");
// -->
</Script>

Set as Homepage
<A href = # onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('url'); "> set as homepage </A>

Add to favorites
<A href = "javascript: window. external. AddFavorite ('url', 'title')"> Add to favorites </A>

Text scroll
Insert a table with one row and one column with a border of 0, Enter text in the table, select text,
Press ctrl + t and enter marquee ction = "up". Press enter to scroll up the text in the table area.
(Right and down can be used to scroll the text or image to the right and down. modifying the original html code can also get the desired rolling speed.

Form Verification
<SCRIPT language = javascript>
Function checkform (theform ){
If (theform. name. value = ""){
Alert ("name cannot be blank! ");
Theform. name. focus ();
Return false;
}
If (theform. tel. value = ""){
Alert ("the phone number cannot be blank! ");
Theform. tel. focus ();
Return false;
}
}
</SCRIPT>

Define mouse
Body {cursor: url (cur. ani or cur );}

Insert videos as images

Layer on flash
<Param name = "wmode" value = "opaque">

Delayed jump
<Meta http-equiv = refresh content = '3; url = javascript: window. close (); '>

Navigation bar color change:
Insert onmouseover = "javascript: this. bgColor = '# 57ae00'" onmouseout = "javascript: this. bgColor =' # 99ccff'" after the cell <TR '"

Center
<CENTER> </CENTER>

Empty Link
Javascript :;

Title table
<Fieldset>
<Legend> table description </legend>
</Fieldset>

Line table
Style = "BORDER-COLLAPSE: collapse ;"

Color Code of the scroll bar
BODY {
SCROLLBAR-FACE-COLOR: # FFFFFF;
SCROLLBAR-HIGHLIGHT-COLOR: # FFFFFF;
SCROLLBAR-SHADOW-COLOR: # FFFFFF;
SCROLLBAR-3DLIGHT-COLOR: # FFCBC8;
SCROLLBAR-ARROW-COLOR: # FFFFFF;
SCROLLBAR-TRACK-COLOR: # FFFFFF;
SCROLLBAR-DARKSHADOW-COLOR: # FFCBC8;
SCROLLBAR-BASE-COLOR: # FFFFFF
}

Continuous English or a bunch of exclamation marks !!! Will not automatically wrap
As long as the following sentence is defined in CSS, the web page will no longer be supported

Table {table-layout: fixed ;}
Td {word-break: break-all; word-wrap: break-word ;}

Note:

1. The first table {table-layout: fixed;}. This style can be included in the table !!! Automatically wrap a line when a character such as an exclamation point (Exclamation point.

2. td {word-break: break-all}. This statement is usually used, but it will be supported in some special circumstances, therefore, you need to add the following sentence {word-wrap: break-word;} to solve the problem. This style can automatically wrap some consecutive English words in the table.

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.