Highlights of Common Code problems in web design

Source: Internet
Author: User

How can I remove the scroll bar on the right of the home page?
<Body scroll = "no">
<Body style = "overflow-Y: hidden">
********************************
How can I not use the page cache? That is, every time a page is opened, it is not called in the cache.
<Meta HTTP-EQUIV = "Pragma" content = "no-Cache">
********************************
How can I ignore the context menu?
<Body oncontextmenu = "Return false">
********************************
How can I control CSS attributes of different links on the same page?
A: active {}
A: link {}
A: visited {}

A.1: Active {}
A.1: link {}
A.1: visited {}
Define a new identifier in CSS of dw4. According to the HTML syntax, the hyperjoin is
A. Yours: Link A. Yours: hover
Yours can be changed to your own words
After selecting a connection, click yours in the CSS area.
You can define n labels and N mouse over effects as needed.
********************************
Email processing submission form
<Form name = "form1" method = "Post" Action = "mailto: webmaster@51js.com" enctype = "text/plain">
<Input type = submit>
</Form>
********************************
Is it possible to use layers to cover flash?
1. Add <Param name = "wmode" value = "Transparent">
2. <body onblur = self. Focus ()>
********************************
How to call the corresponding page according to the screen resolution?
Onclick = alert ("your display resolution is:" + screen. Width + "×" + screen. Height)
First, make a few pages. For example, if an htm1.htm is 800*600, the htm2.htm is 1024*768.
Then, in index.htm of your portal page, Judge:
<HTML>
<Head>
<Script language = JavaScript>
<! --
Function mhref (){
If (screen. width = 1024) location. href = "htm2.htm ";
Else if (screen. width = 800) location. href = "htm1.htm ";
Else return (false );
}
// -->
</SCRIPT>
</Head>
<Body onload = "mhref ();">
</Body>
</Html>
********************************
How does one pop up a window with only the status bar?
<HTML>
<Head>
<Title> open () Close () </title>
<Script language = "JavaScript" type = "text/JavaScript">
<! --
Function openwin ()
{
VaR newwin = open ("", "", "menubar = 1, Height = 200 ");
Newwin.doc ument. Write ("<form> ");
Newwin.doc ument. Write ("click the following button to close the window: <p> ");
Newwin.doc ument. Write ("<input type = button value = 'close 'onclick = Window. Close ()> ");
Newwin.doc ument. Write ("</form> ");
}
</SCRIPT> <Body>
<Div align = center>
<H2> click the following button to display a new window... </H2>
<Form name = form1>
<Input type = button value = "new window 1 [show address bar only]" onclick = Window. Open ('', 'new1', 'location = 1')>
<Input type = button value = "new window 2 [display the status bar only]" onclick = Window. Open ('','', 'status = 1')>
<Input type = button value = "new window 3 [display toolbar only]" onclick = Window. open ('', 'new2', 'toolbar = 1, Height = 200, width = 450 ')>
<Input type = button value = "New Window 4 [display menu bar only]" onclick = openwin ()>
<Input type = button value = "new window 5 [one or more]" onclick = Window. Open ('', 'new5')>
<Input type = button value = "new window 6 [single stick but adjustable size]" onclick = Window. Open ('HTTP: // www.51js.com/forumdisplay.php? Forumid = 32 # thread', 'new6', 'resizable = 1')>
</Form>
</Div>
</Body>
</Html>
********************************
How to leave a hyperlink ununderlined
In Source code <Head>... </Head>: Code :
<Style type = "text/CSS"> <! --
A {text-Decoration: None}
--> </Style>
********************************
How can I disable a webpage automatically.
<HTML>
<Head>
<Object ID = closes type = "application/X-oleobject" classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<Param name = "command" value = "close">
</Object>
</Head>
<Body onload = "window. setTimeout ('closes. Click () ', 10000)">
This window will be automatically closed after 10 seconds, and no prompt will appear. </body>
********************************
How can I go to another page in a few seconds?
The code snippet is as follows:
<Meta HTTP-EQUIV = "refresh" content = "10; url = http://www.51js.com">
Jump to the homepage of 51js. com in 10 seconds
********************************
How can I connect the RealPlayer file to the webpage for an audition?
<Embed Height = 25 src = 51js. RM type = audio/X-PN-RealAudio-plugin width = 50 autostart = "false" controls = "playbutton">
********************************
How can I remove the upper and lower scroll bars of IE?
<Body style = 'overflow: Scroll; overflow-Y: Den den '>
</Body>
********************************
What is the difference between event. X and event. clientx?
When event. clientx returns an event, the mouse is relative to the X coordinate of the customer window.
The same is true for event. X.
However, if the property value of the event object is set to relative
Event. clientx unchanged
Event. x returns the coordinates of the event object relative to the ontology.
Detailed description of event object icooe 2000.3.31 http://www.51js.com/
Event indicates the event status, such as the event element and the mouse position. The event object is valid only during the event process.

Event property:

Altkey
Retrieves the current state of the Alt key
The possible value true is disabled.
False indicates not to close

Button
Retrieve the pressed mouse key
Possible value: 0 without buttons
1 left click
2. Right-click
3. Press the Left or Right key.
4. Press the intermediate key
5. Press the left and intermediate keys.
6. Right-click and select intermediate key.
7. Press all keys

Cancelbubble
Set or retrieve whether the current event will bubble the event handle
Possible value: false enable blister
True cancel this event bubble

Clientx
Retrieves the X coordinates of the mouse cursor related to the client area of the window. The attribute is read-only and there is no default value.

Clienty
Retrieves the Y coordinate of the mouse cursor related to the client area of the window. The attribute is read-only and there is no default value.

Ctrlkey
Ctrlkey: retrieves the current status of the ctrl key
The possible value true is disabled.
False indicates not to close

Dataworks
Retrieve the columns affected by oncellchange

Atransfer
Provides a pre-defined clipboard format for drag-and-drop operations.

Element
Retrieve the object pointer that exits during onmouseover and onmouseout events

Keycode
Set or retrieve the Unicode keyword code associated with the keyword that triggers the event
This attribute is used with onkeydown onkeyup onkeypress.
If no keyword is triggered, the value is 0.

Offsetx
Retrieve the horizontal coordinates of the mouse position related to the object that triggered the event

Offsety
Retrieve the vertical coordinates of the mouse position related to the object that triggered the event

Propertyname
Retrieve the name of the feature that has been changed on the object

Reason
Retrieve the data transfer results of the data source object
Possible values:
0 data transmission successful
1. Data Transmission failed.
2. Data Transmission Error

Recordset
Retrieve the reference of the default record set in the data source object
This feature is read-only.

Repeat
Checks whether an event is repeated.
This attribute returns true only when the onkeydown event is repeated.

Returnvalue
Set or retrieve the value returned from the event
Possible values:
The value in the true event is returned.
False: the default operation of events on the source object is canceled.

Screenx
Retrieve the horizontal positions of the mouse related to the User Screen

Screeny
Retrieve the vertical positions of the mouse related to the User Screen

Shiftkey
Retrieves the current status of the shiftkey.
The possible value true is disabled.
False indicates not to close

Srcelement
Retrieve the trigger event object

Srcfilter
Retrieve the filter object triggered by the onfilterchange event

Srcum
Retrieve the same resource name that triggers event Behavior
This feature is set to null unless both of the following conditions are true.
1. The action is appended to the element of the trigger event.
2. The behavior defined in the previous project symbol already specifies an urn identifier and triggered event
Toelement
Retrieve the object that is moved as the result of the onmouseover or onmouseout event
Type
Retrieve the event name in the event object
X
Returns an integer relative to the horizontal coordinate of the cursor of the parent element.
Y
Returns an integer relative to the vertical coordinate of the parent element.
**************************************** ****
How to keep a window always at the top?
<A onclick = AA ()> click here </a>
<Script language = 'javascript '>
Function AA (){
Y = Window. showmodaldialog ("http://www.51js.com", "", "height: 300; width: 275; help: No ");
}
</SCRIPT>
**************************************** ****
Target = "_ blank" specifies that the link is opened in a new window. What is the role of target = "_ parent", target = "_ Self", and target = "_ top?
Target = "_ parent", previous framework
Target = "_ Self", window, framework
Target = "_ top" Top framework.
For a more detailed explanation, I found it from zhimeng supply network:
_ Blank

Open a new window without a named window.

_ Self

The result of the unordered operation is displayed on the same subplane, ignoring the settings of the base.

_ Parent

The result of the explain result is displayed in the parent interface (that is, the frameset in the previous example.

_ Top

The upper part of the window Indicates the upper part of the window. The upper part of the window indicates that the entire window is cleared and then connected to the upper part of the window.
**************************************** ****
How can I make a netizen collect this website? What is displayed in favorites is not the unchanging icon of Microsoft, but the icon selected by me?
<Link href = "fav. ICO" rel = "shortcut icon">
Add the hade tag, and place the clip in the root directory. It must be in. ICO format.
Some blank spaces cannot be placed directly in the root directory
Required
<Link href = "/. ICO" rel = "shortcut icon">
**************************************** ****
How do I listen to a window closed?
<Body onUnload = "alert ('You closed this Windows')">
**************************************** ****
What are innerhtml and outerhtml ......... And innertext?
<Div id = test> <Table> <tr> <TD> text <A> link </a> another text </TD> </tr> </table> </div>
<Input type = button onclick = alert (test. innertext) value = "show innertext"> <br>
<Input type = button onclick = alert (test. innerhtml) value = "show innerhtml"> <br>
<Input type = button onclick = alert (test. outerhtml) value = "show outerhtml"> <br>
**************************************** ****
Window Method list!
It is found that some people often ask questions about window operations,
So it took some time to sort out this article. Article ,
I hope no one will ask this question in the future.

Method list of window in IE

Alert (smsg)
// A confirmation message box is displayed.
Attachevent (sevent, pfunction)
// Bind a function to an event. When an event is triggered, a bound function is randomly executed.
Blur ()
// Cause the window to lose focus

Clearinterval (iintervalid)
// Clear the correlated functions of the specified Timer
Cleartimeout (itimeoutid)
// Clear the correlated functions of the specified Extension
Close ()
// Close the window. If the window is not opened by a script, a confirmation dialog box is displayed.
Confirm ([smessage])
// The "OK/cancel" dialog box is displayed.
Createpopup ([vargs])
// Create a hidden pop-up window. vargs is a parameter to be provided in future. The return window handle
Detachevent (sevent, pfunction)
// Cancel a function bound to an event
ExecScript (sexpression, slanguage)
// Execute the code in the specified language
Focus ()
// Activation window

MoveBy (IX, Iy)
// Move the window in relative mode
MoveTo (ileft, iTOP)
// Move the window in absolute Mode
Navigate (Surl)
// Switch to the specified connection

Open ([Surl] [, sname] [, sfeatures] [, breplace])
// Open a new window and return the window handle
// Sname = (* _ blank: open a new untitled window; _ parent: open in the parent window; _ search: Open the search window at the same time; _ Self: replace this window; _ top: open in the top-level window ;*)
// Sfeatures = (* channelmode = {Yes | no | 1 | 0}; directories = {Yes | no | 1 | 0 }; fullscreen = {Yes | no | 1 | 0}; Height = number; left = number; location = {Yes | no | 1 | 0 }; menubar = {Yes | no | 1 | 0}; resizable = {Yes | no | 1 | 0}; scrollbars = {Yes | no | 1 | 0 }; status = {Yes | no | 1 | 0}; titlebar = {Yes | no | 1 | 0}; toolbar = {Yes | no | 1 | 0}; Top = number; width = number ;*)

Print ()
// Print the document content in the current window
Prompt ([smessage] [, sdefaultvalue])
// The input dialog box is displayed.
ResizeBy (IX, Iy)
// Change the window size in relative mode
ResizeTo (iwidth, iheight)
// Change the window size in absolute Mode

Scroll (IX, Iy)
A method that is retained out of compatibility for the same effect as scrollto.
Scrollby (IX, Iy)
// Scroll the window in relative mode
Scrollto (IX, Iy)
// Scroll the window in absolute Mode
Setactive ()
// Activate the target without turning the line of sight to the target
Setinterval (vcode, imilliseconds [, slanguage])
// Periodically execute a piece of code
SetTimeout (vcode, imilliseconds, slanguage)
// Execute code in a delayed manner
ShowHelp (Surl [, vcontextid])
// Open a Help file. The Surl is the help document address, and the vcontextid is the help index number.
Showmodaldialog (Surl [, varguments] [, sfeatures])

Showmodaldialog (Surl [, varguments] [, sfeatures])
// Open a mode dialog box
// Varguments = parameters to be passed to the New Mode dialog box
// Sfeatures = (* dialogheight: sheight; dialogleft: sxpos; dialogtop: sypos; dialogwidth: swidth; center: {Yes | no | 1 | 0 | on | off}; dialoghide: {Yes | no | 1 | 0 | on | off}; edge: {sunken | raised}; help: {Yes | no | 1 | 0 | on | off}; resizable: {Yes | no | 1 | 0 | on | off}; scroll: {Yes | no | 1 | 0 | on | off}; Status: {Yes | no | 1 | 0 | on | off}; unadorned: {Yes | no | 1 | 0 | on | off };*)

Showmodelessdialog (Surl [, varguments] [, sfeatures])
// Open a non-mode dialog box
// Vargument = parameters to be passed to the New Mode dialog box
// Sfeatures = (* dialogheight: sheight; dialogleft: sxpos; dialogtop: sypos; dialogwidth: swidth; center: {Yes | no | 1 | 0 | on | off}; dialoghide: {Yes | no | 1 | 0 | on | off}; edge: {sunken | raised}; help: {Yes | no | 1 | 0 | on | off}; resizable: {Yes | no | 1 | 0 | on | off}; scroll: {Yes | no | 1 | 0 | on | off}; Status: {Yes | no | 1 | 0 | on | off}; unadorned: {Yes | no | 1 | 0 | on | off };*)
**************************************** ****
Execcommand full reference (Chinese Version)
Document.exe ccommand (scommand [, interaction mode, dynamic parameters])

2d-positionexcepdocument.exe ccommand ("2d-position", "false", "true"); enables direct drag of absolutely positioned objects; ie5.5
Absolutepositionexcepdocument.exe ccommand ("absoluteposition", "false", "true"); Changes object positioning to absolute positioning; ie5.5
Backcolor1_document.exe ccommand ("backcolor", "false", scolor); set the background color; ie4.0
Blockdirltr; none; Enable block-level element layout from left to right ?; Not Supported
Blockdirrtl; none; Enable block-level element layout from right to left ?; Bold1_document.exe ccommand ("bold", "false", null) is not supported; the text in the selected area is bold; ie4.0
Browsemode; none; set the browser mode ?; Copy is not supported;
Document.exe ccommand ("copy", "false", null); copy the selected text to the clipboard; ie4.0 createbookmark#document.exe ccommand ("createbookmark", "false", sanchorname ); set the specified anchor as a bookmarks; ie4.0
Createlinkappsdocument.exe ccommand ("CreateLink", "false", slinkurl); converts the selected text to hyperjoin. If the second parameter is true, the Parameter Setting dialog box is displayed. ie4.0
Cutaskdocument.exe ccommand ("cut", "false", null); clipboard selected text; ie4.0
Deleteappsdocument.exe ccommand ("delete", "false", null); Delete selected text; ie4.0
Dirltr; none; the layout is left to right ?; Dirrtl; none is not supported. The layout is from right to left ?; Not Supported
Editmode; none; set the editing mode ?; Not Supported
Fontname;document.exe ccommand ("fontname", "false", sfontname); change the font of the selected area; ie4.0
Fontsizeappsdocument.exe ccommand ("fontsize", "false", ssize | isize); changes the font size of the selected area; ie4.0
Forecolorappsdocument.exe ccommand ("forecolor", "false", scolor); Set foreground color; ie4.0
Formatblockappsdocument.exe ccommand ("formatblock", "false", stagname); set the label name of the current block; ie4.0
**************************************** ****
How can I add pages to my favorites?
<A href = "javascript: window. External. AddFavorite ('HTTP: // www.51js.com ', 'Worry-free script')"> Add a worry-free script to favorites </a>
**************************************** ****
How can I make the browser fail to save the page?
<NoScript>
<IFRAME src = "*. html">
</Iframe>
</NoScript>
**************************************** ****
How does one select all the check boxes on a page?
<Input type = checkbox>
<Input type = checkbox>
<Button onclick = selectall ()> selectall </button>
<SCRIPT>
Function selectall ()
{
VaR cinput = Document. All. Tags ('input ');
For (var I in cinput)
If (cinput [I]. type = 'checkbox') cinput [I]. Checked = true;
}
</SCRIPT>
**************************************** ****
How can I refresh CSS without refreshing a new page?
<Style>
Button {color: #000000 ;}
</Style>
<Button onclick = document. stylesheets [0]. rules [0]. style. color = 'red'> click the button to change the button selection character in the style label to Red. </button>

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.