Common practice encountered in the development

Source: Internet
Author: User
Tags microsoft frontpage

1. oncontextmenu= "Window.event.returnvalue=false" will completely shield the right mouse button
<table border Oncontextmenu=return (false) ><td>no</table> available for table

2. <body onselectstart= "return false" > deselect, prevent copying

3. onpaste= "return false" no paste

4. oncopy= "return false;" oncut= "return false;" Prevent replication

5. <link rel= "Shortcut icon" href= "Favicon.ico" > IE Address bar before switching to their own icon

6. <link rel= "Bookmark" href= "Favicon.ico" > can display your icon in the Favorites folder

7. <input style= "ime-mode:-disabled" > Close IME

8. Always with frame
<script language= "JavaScript" ><!--
if (window = = top) Top.location.href = "frames.htm"; Frames.htm for frames page
--></script>

9. Prevent people from being frame
<script language=javascript><!--
if (top.location! = self.location) top.location=self.location;
--></script>

10. Web pages will not be saved as
<noscript><iframe src=*.html></iframe></noscript>

<input type=button value= View Web page source code
onclick= "window.location = ' view-source: ' + http://www.aa25.cn/'";>

12. Confirm when deleting
<a href= ' Javascript:if ("Are you sure you want to delete it?") location= "boos.asp?&areyou= Remove &page=1" ' > Delete

Except </a>

13. Get the absolute position of the control
Javascript
<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>

VBScript
<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 (& "left=" &l,64, "get control position"
End Function
--></script>

14. The cursor is stopped at the end of text in the textbox
<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 name=text1 value= "123" onfocus= "CC ()" >

15. Determine the origin of the previous page
Javascript:
Document.referrer

16. Minimize, maximize, close the window
<object id=hh1 classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
<param name= "Command" value= "Minimize" ></object>
<object id=hh2 classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
<param name= "Command" value= "Maximize" ></object>
<object id=hh3 classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
<param name= "Command" value= "Close" ></OBJECT>

<input Type=button value= minimizes onclick=hh1. Click () >
<input Type=button value= maximizes onclick=hh2. Click () >
<input Type=button value= Close Onclick=hh3. Click () >
This example applies to IE

17. Shielding function Key Shift,alt,ctrl
<script>
function Look () {
if (Event.shiftkey)
Alert ("Do not press SHIFT!";//Can be replaced by Alt CTRL
}
Document.onkeydown=look;
</script>

18. Web pages are not cached
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache, must-revalidate" >
<meta http-equiv= "Expires" Content= "Wed, 1997 08:21:57 GMT" >
or <meta http-equiv= "expires" content= "0" >

19. How do I make the form feel less bump?
<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>

The difference between 20.<div><span>&<layer>?
<div> (division) is used to define a large segment of the page element, resulting in a career change
<span> is used to define elements within the same line, and the only difference between <div> is that there is no change of career
<layer> is the NS mark, IE is not supported, equivalent to <div>

21. Make the pop-up window always on top:
<body onblur= "This.focus (); >

22. Do not scroll bars?
Let the vertical bar not:
<body style= ' Overflow:-scroll;overflow-y:hidden ' >
</body>
Let the bars not:
<body style= ' Overflow:-scroll;overflow-x:hidden ' >
</body>
Two of them all removed? More simple.
<body scroll= "No" >
</body>

23. How do I remove the dotted line around the image when I click the image link?
<a href= "#" onfocus= "This.blur ()" ></a>

24. Email Processing Submission Form
<form name= "Form1" method= "Post" action= "mailto:****@***.com" enctype= "Text/plain" >
<input type=submit>
</form>

25. How do I write in the code that refreshes the parent window of the Open child window?
Window.opener.location.reload ()

26. How to set the size of the open page
<body onload= "Top.resizeto (300,200);" >
Where to open the page <body onload= "Top.moveby (300,200); >

27. How to add a background image that is not full on the page, the background image does not move when pulling the page
<style>
Body
{Background-image:url (logo.gif); background-repeat:no-repeat;

Background-position:center;background-attachment:fixed}
</style>

28. Check to see if a string is all made up of numbers
<script language= "JavaScript" ><!--
function Checknum (str) {return Str.match (//d/) ==null}
Alert (Checknum ("1232142141"
Alert (Checknum ("123214214A1"
--></script>

29. Get the size of a window
Document.body.clientWidth; Document.body.clientHeight

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

31.TEXTAREA Adaptive number of lines of text
<textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" >
</textarea>

32. Date minus number of days equals second date
<script language=javascript>
function cc (DD,DADD)
{
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>

33. Which radio are selected
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>

34. Scripts never go wrong
<script language= "JavaScript" >
<!--Hide
function Killerrors () {
return true;
}
Window.onerror = killerrors;
-
</SCRIPT>

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

36. 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]= "http://www.aa25.cn/";
autourl[2]=www.aa24.cn/";
Autourl[3]= "www.aa24.com.cn/";
Autourl[4]= "http://www.9tour.cn/";
Autourl[5]= "http://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 value= Test ......> =" <input type=text

Name=url "+i+" size=40> = "<input Type=button value=go

Onclick=window.open (This.form.url "+i+". Value) ><br> "
document.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 timed out"}
Else
{document.forms[0]["txt" +b].value= "time" +tim/10+ "Seconds"}
b++
}
function run () {for (Var i=1;i<autourl.length;i++) document.write ("

src=http://"+autourl+"/"+math.random () +" Width=1 height=1

Onerror=auto (http://"; +autourl+" ') > "}
Run () </script>

37. Various styles of cursors
Auto: Standard cursor
Default: Standard arrow
Hand: Hand Cursor
Wait: Waiting cursor
Text:i-shaped cursor
Vertical-text: Horizontal I-shaped cursor
No-drop: Cannot drag cursor
Not-allowed: Invalid cursor
Help:? Aid cursor
All-scroll: Triangle Direction mark
Move: Moving the label
Crosshair: Cross-label
E-resize
N-resize
Nw-resize
W-resize
S-resize
Se-resize
Sw-resize

38. Page entry and exit effects
Go to page <meta http-equiv= "Page-enter" content= "Revealtrans (duration=x, transition=y)" >
Launch page <meta http-equiv= "Page-exit" content= "Revealtrans (duration=x, transition=y)" >
Here are some special effects when the page is loaded and paged out. Duration indicates the duration of the effect, in seconds. Transition means that the

Which effect to use, the value is 1-23:
0 Rectangle reduction
1 Rectangle Enlargement
2 Round Zoom Out
3 Circular Enlargement
4 down to top refresh
5 Top to bottom refresh
6 Left to right refresh
7 right-to-left refresh
8 Vertical Blinds
9 Horizontal Blinds
10 Dislocation Horizontal Blinds
11 Dislocation Vertical Blinds
12-point diffusion
13 or so to the middle refresh
14 Middle to left and right refresh
15 middle to upper and lower
16 up and down to the middle
17 right down to top left
18 top right to bottom left
19 top left to bottom right
20 lower left to top right
21 Horizontal Bar
22 Vertical Bar
23 or more 22 random selection of a

39. Jump within the specified time
<meta http-equiv=v= "REFRESH" content= "5; Url=http://www.51js.com ">

40. Whether the webpage is retrieved
<meta name= "ROBOTS" content= "attribute value" >
There are some of the following property values:
The property value is "All": The file will be retrieved and the link on the page can be queried;
The property value is "None": The file is not retrieved and the link on the page is not queried;
The property value is "index": The file will be retrieved;
The property value is "Follow": the link on the query page;
The property value is "Noindex": The file is not retrieved but can be queried for links;
The property value is "nofollow": The file is not retrieved, but the link on the page can be queried.

41. Changing the mouse cursor of a Web page
<body style= "Cursor:url (http://203.73.125.205/~liangmi2/farmfrog01.cur ')" >

42. How do I achieve the effect of displaying small icons on the taskbar? (To use absolute address)
Some sites, access will appear in the Address bar address before the small icon, added to the collection also in the Favorites bar display icon,
This is very good and other sites have a difference.
To achieve this effect, you need to make this icon file, the image is 16*16 pixels, not more than 16 colors. The file format is ico and then uploaded to your website.
Then, in the desired page, add the following HTML statement to the file's <link rel= "SHORTCUT ICON" href= "Http:///happyisland.126.com/icon.ico";>
If the visitor's browser is IE5.0, there is no need to add any code, just upload the icon file to the root directory of the Web site.
What does the code in the 1,meta tag mean?
<META> is a marker that is placed between <HEAD> and </HEAD>. Here are some of the most common things I've summed up in Web pages.
<meta name= "Keywords" content= "pictures, news, music, software" >
The page's keywords, which are used for search engine login, in fact it is not useful in the current website.
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 ">
Set this is the HTML file and its encoding language, Simplified Chinese web page Use charset=gb2312, Traditional Chinese use charset=big5, or do not set the code can also, pure English page recommended the use of iso-8859-1.
<meta name= "GENERATOR" content= "Microsoft FrontPage 5.0" >
This only means that the page is written by what editor.
<meta http-equiv= "Refresh" content= "10; Url=http://www.hkiwc.com ">
This line is more practical and can be automatically transferred to the specified URL within a predetermined number of seconds. In the original code, 10 means 10 seconds.

2, how to change the color of the scroll bar, only ie5.5 version above to support.
This is the use of the CSS language, in the second note, it and my browser version has a certain relationship.
Scrollbar-arrow-color: The color of the triangular arrows on the top and bottom buttons.
Scrollbar-base-color: The basic color of the scroll bar.
Scrollbar-dark-shadow-color: Color of the strong shadow of a solid scroll bar
Scrollbar-face-color: Color of the protruding part of a solid scroll bar
Scrollbar-highlight-color: The color of the blank part of the scroll bar
Scrollbar-shadow-color the color of the solid scrollbar shadow.
Scrollbar-track-color: #99CC33;
Scrollbar-3dlight-color: #A8CBF1;
The code is as follows:
<style>
<!--
BODY {
Scrollbar-face-color: #99CC33;//(Color of the protruding part of the solid scrollbar)
Scrollbar-highlight-color: #A8CBF1;//(Color of the blank part of the scroll bar)
Scrollbar-shadow-color: #A8CBF1;//(Color of the solid scrollbar shadow)
Scrollbar-arrow-color: #FF9966;//(The color of the triangular arrows on the upper and lower buttons)
Scrollbar-base-color: #A8CBF1; (Basic color of scroll bar)
Scrollbar-darkshadow-color: #A8CBF1; (The color of the solid scroll bar strong shadow)
Scrollbar-track-color: #99CC33;
Scrollbar-3dlight-color: #A8CBF1;
}
-
</style>
In this I add a few points:
1. Let the browser window never appear scroll bar.
<body style= "Overflow-x:hidden;overflow-y:hidden" > or <body style= "Overflow:hidden" > or <body scroll=no >
2, no horizontal scroll bar
<body style= "Overflow-x:hidden" >
3, no vertical scroll bar
<body style= "Overflow-y:hidden" >

3, how to give the picture jitter how to do.
<script language=javascript1.2>
<!--
var rector=2
var stopit=0
var a=1
var count=0
function init (which) {
Stopit=0
Shake=which
Shake.style.left=0
Shake.style.top=0
}
function Rattleimage () {
if ((!document.all&&!document.getelementbyid) | | | stopit==1| | COUNT==100)
Return
count++
if (a==1) {
Shake.style.top=parseint (shake.style.top) +rector
}
else if (a==2) {
Shake.style.left=parseint (Shake.style.left) +rector
}
else if (a==3) {
Shake.style.top=parseint (shake.style.top)-rector
}
else{
Shake.style.left=parseint (Shake.style.left)-rector
}
if (a<4)
a++
Else
A=1
SetTimeout ("Rattleimage ()", 50)
}
function Stoprattle (which) {
Stopit=1
Count=0
Which.style.left=0
Which.style.top=0
}
-
</SCRIPT>
<style>.shakeimage {position:relative}
</style>


Javascript:window.onblur=function () {}

Common practice encountered in the development

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.