Common webpage code and webpage code
1. How do I control the explicit and implicit display of horizontal and vertical scroll bars?
<Body style = "overflow-y: hidden"> remove the X axis.
<Body style = "overflow-x: hidden"> remove the Y axis.
<Body scroll = "no"> not displayed
2. Table color change
<TD onmouseover = "this. style. backgroundColor = '# ffff '"
Onmouseout = "this. style. backgroundColor = ""
Style = "CURSOR: hand">
3. Prohibit copying. Drag and select
<Body ondragstart = window. event. returnValue = false oncontextmenu = window. event. returnValue = false onselectstart = event. returnValue = false>
4. Common iframe page
<Iframe name = "name" src00000000main.htm "width =" 450 "height =" 287 "scrolling =" Auto "frameborder =" 0 "> </iframe>
5. iframe adaptive height
<Iframe name = "pindex" src = "index. asp "frameborder = false scrolling =" auto "width =" 100% "height =" 100% "frameborder = no onload?#document.all='pindex'{.style.height=pindex.doc ument. body. scrollHeight "> </iframe>
6. change to your own icon in front of the IE Address Bar & your icon can be displayed in favorites
<Link rel = "Shortcut Icon" href = "favicon. ico">
<Link rel = "Bookmark" href = "favicon. ico">
7. font size scaling
More and more people are making a bubble for a long time, and the penetration rate of glasses is getting higher and higher, which makes the text bigger and clearer to more users.
<Script type = "text/javascript">
Function doZoom (size)
{Document. getElementById ('zoom '). style. fontSize = size + 'px ';}
</Script>
<Span id = "zoom"> text to be specified </span>
<A href = "javascript: doZoom (16)"> large </a> <a href = "javascript: doZoom (14) "> medium </a> <a href =" javascript: doZoom (12) "> small </a>
8. How to block div using select statements
Add the following code to the div and adjust it as needed.
<Iframe src = "javascript: false" scrolling = "no" frameborder = "0" style = "z-index:-1; position: absolute; top: 5px; left: 2px; width: 168; height: 100px; ">
</Iframe>
9. iframe (embedded frame) Adaptive height
The entered embedded address must be on the same site as the current page. Otherwise, the system will prompt "Access Denied !". You have permission for cross-Origin references. For more information, see.
<Iframe name = "guestbook" src = "gbook/index. asp "scrolling = no width =" 100% "height =" 100% "frameborder = no onload?#document.all='guestbook'{.style.height=guestbook.doc ument. body. scrollHeight "> </iframe>
10. Jump to the new menu window
<Select name = "select" onchange = "window. open (this. options [this. selectedIndex]. value)">
<Option value = "http://www.microsoft.com/ie”> Internet Explorer </option>
<Option value = "http://www.microsoft.com"> Microsoft Home </option>
<Option value = "http://msdn.microsoft.com"> Developer Network </option>
</Select>
11. Transparent flash options
<Param name = "wmode" value = "transparent">
12. Add to favorites and set as Homepage
<A href = # onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.makewing.com/lanren/'); "> set as homepage </a>
<A href = "javascript: window. external. AddFavorite ('HTTP: // www.makewing.com/lanren/', 'others')"> Add your site to favorites </a>
13. Record and display the last modification time of the webpage
<Script language = JavaScript>
Document. write ("Last Update time:" + document. lastModified + "")
</Script>
14. Holiday countdown
<Script Language = "JavaScript">
Var timedate = new Date ("October ″);
Var times = "National Day ";
Var now = new Date ();
Var date = timedate. getTime ()-now. getTime ();
Var time = Math. floor (date/(1000*60*60*24 ));
If (time> = 0)
Document. write ("now" + times + "and" + time + "day ")
</Script>
15. Add it to the HEAD
Disable caching
<Meta http-equiv = "Expires" CONTENT = "0">
<Meta http-equiv = "Cache-Control" CONTENT = "no-cache">
<Meta http-equiv = "Pragma" CONTENT = "no-cache">
16. Transparent background of documents in the IFRAME framework
<Iframe src = "about: <body style = 'background: transparent '>" allowtransparency> </iframe>
17. Open a window to maximize
<Script language = "JavaScript">
<! -Begin
Self. moveTo (0, 0)
Self. resizeTo (screen. availWidth, screen. availHeight)
// End->
</Script>
18. Add background music
<Bgsound src = "mid/windblue [1]. mid" loop = "-1"> only applicable to IE
<Embed src = "music. mid" autostart = "true" loop = "true" hidden = "true"> applicable to both Netscape and IE
19. Scroll
<Marquee direction = up height = 146 onmouseout = start () onmouseover = stop () scrollAmount = 2> scroll Information
</Marquee>
20. When you click an empty link, the page is often reset to the top.
The Code "javascript: void (null)" replaces the original "#" mark
21. text or image pop-up window of the specified size
Add in body
<Script language = "JavaScript" type = "text/JavaScript">
Function MM_openBrWindow (theURL, winName, features) {window. open (theURL, winName, features );}
</Script>
Pop-up code
<A href = "#" target = "_ self" onclick1_mm_openbrwindow('windows01.htm', ", 'width = 550, height = 380 ′) "width =" 550 "height =" 380 "border =" 0 "> image or text </a>
22. flash button and link
On (press ){
GetURL (http://www.makewing.com, _ blank ");
}
23. Jump Page code
<Meta http-equiv = "refresh" content = "5; url = http://www.makewing.com">
24. line separation
<Hr noshade size = 0 color = # C0C0C0>
25. Automatic line feed on the webpage
<Td style = "word-break: break-all">.
Complete is
Style = "table-layout: fixed; WORD-BREAK: break-all; WORD-WRAP: break-word"
26. Remove the image toolbar that automatically appears in ie6 and set the GALLERYIMG attribute to false or no.
27. Prohibit page body content from being selected
<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 () ">
28. You cannot right-click it, or press CTRL + A to copy it!
<Body oncontextmenu = "window. event. returnValue = false"
Onkeypress = "window. event. returnValue = false"
Onkeydown = "window. event. returnValue = false"
Onkeyup = "window. event. returnValue = false"
Ondragstart = "window. event. returnValue = false"
Onselectstart = "event. returnValue = false">
</Body>
29. Internet Explorer supports a Body attribute bgproperties, which can prevent the background from rolling:
<Body Background = "Image File" bgproperties = "fixed">
30. Random conversion of background images (a special effect that refreshes the mood)
<Script Language = "JavaScript">
Image = new Array (4); // defines the image as an Array of the number of images.
Image [0] = 'tu0.gif '// path of the background image
Image [1] = 'tu1.gif'
Image [2] = 'tu2.gif'
Image [3] = 'tu3.gif'
Image [4] = 'tu4.gif'
Number = Math. floor (Math. random () * image. length );
Document. write ("<body background =" + image [number] + "> ");
</Script>
31. loading videos in flash
On (release)
{
Loadmovie(1-01.swf "," _ root. loaderclip ");
}
32. image form buttons
<Form id = "form1" name = "form1" method = "post" action = "">
</Form>
33. CSS definition method for Left and Right shadow backgrounds
Body {
Text-align: center;
Background-repeat: repeat-y;
Background-position: center;
Background-image: url (../images/bg.jpg );
}
34. Move the mouse over the link
Style = "cursor: hand"
35. How to close the Layer
<Div id = "Layer1"> </div>
<A href = "#" onClick = "Layer1.style. display = 'none'"> close layer </a>
36. Close the window script
<A href = javascript: close ()> [close the window] </a>
37. If the text is too long, the excessive text will be displayed as a ellipsis.
<Div style = "width: 120px; height: 50px; border: 1px solid blue; overflow: hidden; text-overflow: ellipsis">
<NOBR> for example, a row of text is long and cannot be displayed in a table. </NOBR>
</DIV>
38. Automatically maximized upon entering the home page
<Script>
Self. moveTo (0, 0)
Self. resizeTo (screen. availWidth, screen. availHeight)
</Script>
39. Sunken text
<Div style = "width: 300px; padding: 20px; overflow: hidden; word-wrap: break-word; word-break: all; font-size: 12px; line-height: 18px; background-color: # eeeeee; ">
<Font disabled>
How are you doing? <Br>
Don't you want to try it? <Br>
<A href = "http://www.lenvo.cn/"> www.lenvo.cn </a> </font>
</Div>
40. Run the code box
<Script>
Function Preview ()
{Var TestWin = open (");
TestWin.doc ument. write (code. value );}
</Script>
<Textarea id = code cols = 60 rows = 15> </textarea>
<Br>
<Button onclick = Preview ()> RUN </button>
41. link the table
<Table width = "100%" onclick = "window. open ('HTTP: // www.makewing.com/',' _ blank ')" style = "CURSOR: hand">
<Tr>
<Td height = "100" bgcolor = "f4f4f4"> </td>
</Tr>
</Table>
42. Make the pop-up window always on the top
<Body onblur = "this. focus ();">
43. CSS text shadow
. Shadowfont {FILTER: dropshadow (color = #666666, offx = 1, offy = 1, positive = 1); FONT-FAMILY: ""; FONT-SIZE: 9pt; COLOR: # ffffff ;}
44. Back & close the window
Back: javascript: history. back (1)
Close: javascript: window. close ();
45. Table transparency
Style = "FILTER: alpha (opacity = 72 )"
46. How to prevent others from placing your webpage in the framework
<Script language = "javascript"> <! -If (self! = Top) {top. location = self. location;}-> </script>
47. Differences between Alt and Title
Alt is used to prompt the image. Title is used to prompt link text or common text.
<A href = "#" Title = "link text prompt"> text </a>
<P Title = "link text prompt"> text </p>
48. Try to use external calls for all javascript calls
<Script language = "javascript" SRC = "js/xxxxx. js"> </SCRIPT>
49. Link
Response. redirect "login. asp"
Location. href = "xx. asp"
OnClick = "window. location = 'login. asp '"
OnClick = "window. open (")"
50. Basic link Style
A: link indicates the link style.
A: active indicates the style of the current active connection.
A: hover indicates an outdated mouse style.
A: visited indicates the connection style that has been accessed.
"Link-visited-hover-active" is simplified to "lvha", that is, "love" + "hate"
51. Set the style of different text links on the same page
<Style type = "text/css">
. Green {COLOR: #309633}
. Green A: link {COLOR: #309633; TEXT-DECORATION: none}
. Green A: visited {COLOR: #309633; TEXT-DECORATION: none}
. Green A: hover {COLOR: #309633; TEXT-DECORATION: underline}
. Green A: active {COLOR: #309633; TEXT-DECORATION: none}
</Style>
<A href = "#" class = "green"> text </a>