Common JS Code and CSS code collected

Source: Internet
Author: User
Tags set background

<Input onclick = Document. All. webbrowser. execwb (4,1) type = button value = save as name = button2>
<Input onclick = Document. All. webbrowser. execwb (10, 1) type = button value = property name = button3>
<Input onclick = Document. All. webbrowser. execwb (6, 1) type = button value = Print name = button>
<Input onclick = Document. All. webbrowser. execwb (8, 1) type = button value = page setting name = button4>
<Input onclick = Window. Location. Reload () type = button value = Refresh name = Refresh>
<Input onclick = "window. External. importexportfavorites (true,''); "type = button value = import favorites name = button5>
<Input onclick = "window. External. importexportfavorites (false,''); "type = button value = export favorites name = button32>
<Input onclick = "window. External. AddFavorite (location. href, document. Title)" type = button value = add to favorites name = button22>
<Input onclick = "window. External. showbrowserui ('organizefavorites ', null)" type = button value = favorites name = submit2>
<Input onclick = 'window. Location = "view-source:" + window. Location. href 'Type = button value = View Source file name = button7>
<Input onclick = "window. External. showbrowserui ('languagedialog ', null)" type = button value = language setting name = button6>
<Input onclick = "document.Execcommand('Cut ') "type = button value = cut>
<Input onclick = "document.Execcommand('Copy') "type = button value = copy>
<Input onclick = "document.Execcommand('Paste ') "type = button value = paste>
<Input onclick = "document.Execcommand('Undo ') "type = button value = undo>
<Input onclick = "document.Execcommand('Delete') "type = button value = Delete>
<Input onclick = "document.Execcommand('Bold ') "type = button value =>
<Input onclick = "document.Execcommand('Italic ') "type = button value = italic>
<Input onclick = "document.Execcommand('Underline') "type = button value = underline>
<Input onclick = "document.Execcommand('Stop') "type = button value = stop>
<Input onclick = "document.Execcommand('Saveas') "type = button value = save>
<Input onclick = "document.Execcommand('Saveas', false, 'c: // test.htm') "type = button value = Save As>
<Input onclick = "document.Execcommand('Fontname', false, FN) "type = button value = font>
<Input onclick = "document.Execcommand('Fontsize', false, FS) "type = button value = font size>
<Input onclick = "document.Execcommand('Refresh', false, 0) "type = button value = Refresh>
<Input onclick = Window. Location. Reload () type = button value = Refresh>
<Input onclick = history. Go (1) type = button value = forward>
<Input onclick = history. Go (-1) type = button value = back>
<Input onclick = history. Forward () type = button value = forward>
<Input onclick = history. Back () type = button value = back>
<Input onclick = 'window. External. importexportfavorites (true, "http: // localhost";); 'Type = button value = import favorites>
<Input onclick = 'window. External. importexportfavorites (false, "http: // localhost";); 'Type = button value = export favorites>
<Input onclick = "window. External. showbrowserui ('organizefavorites ', null)" type = button value = favorites>
<Input onclick = "window. Location = 'view-Source: '+ window. Location. href" type = button value = View Source File>
<Input onclick = "window. External. showbrowserui ('languagedialog ', null)" type = button value = language Settings>
<Input onclick = "window. External. AddFavorite ('HTTP: // www.behar.cn ', 100,000 reasons)" type = button value = add to favorites>
<Input onclick = "window. External. addchannel ('HTTP: // www.behar.cn ')" type = button value = add to channel>
<Input onclick = "This. style. Behavior = 'url (# default # homepage) '; this. setHomePage ('www .why00000.com')" type = button value = set to homepage>

HTML: Disable IE's image toolbar
<Meta HTTP-EQUIV = "imagetoolbar" content = "no"> to disable, you can also set properties for an IMG Tag Element

Solve the problem that the Select menu border cannot be set

<Span style = "border: 1px solid green; position: absolute; overflow: hidden"> <Select style = "margin:-2px">
<Option> 1111 </option>
<Option> 11111111111111 </option>
<Option> 111111111 </option>
</SELECT> </span>

1. The dotted box when the cancel button is pressed
Add the attribute value hidefocus or hidefocus = true in input.
2. Read-only text box content
Add the attribute value readonly in input.
3. Prevent text files from being cleared (style content can be referenced as a class)
Program code <input style = behavior: URL (# default # savehistory); type = text id = opersistinput>

4. Press enter to move the cursor to the next input box.
Program code <input onkeydown = "If (event. keycode = 13) event. keycode = 9">

5. It can only be Chinese (with flashing)
Program code <input onkeyup = "value = value. Replace (/[-~] /G, '')" onkeydown = "If (event. keycode = 13) event. keycode = 9">

6. Only numbers are allowed (with flashing)
Program code <input onkeyup = "value = value. replace (/[^/d]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^/d]/g, '')">

7. Only numbers are allowed (no flashing)
Program code <input style = "ime-mode: Disabled" onkeydown = "If (event. keycode = 13) event. keycode = 9 "onkeypress =" If (event. keycode <48 | event. keycode> 57) event. returnvalue = false ">

8. Only English and numbers can be entered (with flashing)
Program code <input onkeyup = "value = value. replace (/[/W]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^/d]/g, '')">

9. shielded Input Method
Program code <input type = "text" name = "url" style = "ime-mode: Disabled" onkeydown = "If (event. keycode = 13) event. keycode = 9 ">
10. You can only enter numbers, decimal points, minus (-) characters (no flashing)
Program code <input onkeypress = "If (event. keycode! = 46 & event. keycode! = 45 & (event. keycode <48 | event. keycode> 57) event. returnvalue = false ">

11. Only two decimal places can be entered, and three decimal places (with flashing)
Program code <input maxlength = 9 onkeyup = "If (value. match (/^/d {3} $/) value = value. replace (value, parseint (value/10); value = value. replace (//. /D */. /g ,'. ') "onkeypress =" If (event. keycode <48 | event. keycode> 57) & event. keycode! = 46 & event. keycode! = 45 | value. match (/^/d {3 }$/) | //. /d {3} $ /. test (value) {event. returnvalue = false} "id = text_kfxe name = text_kfxe>

Box Size
There are usually four writing methods:

Property: value1; indicates that all edges are value1;
Property: value1 value2; the value of top and bottom is value1, and the value of right and left is value2.
Property: value1 value2 value3; indicates that the top value is value1, the right and left values are value2, and the bottom value is value3.
Property: value1 value2 value3 value4; four values in turn represent top, right, bottom, left
Easy to remember is clockwise, top right bottom left. An example of the specific application in margin and padding is as follows:
Margin: 1em 0 2em 0.5em;

Border (Border)
The border attributes are as follows:

Border-width: 1px;
Border-style: solid;
Border-color: #000;
It can be abbreviated as border: 1px solid #000;

Syntax: Border: width style color;

Background (backgrounds)
The attributes of the background are as follows:

Background-color: # f00;
Background-image: url(background.gif );
Background-repeat: No-Repeat;
Background-Attachment: fixed;
Background-position: 0 0;
It can be abbreviated as: Background: # f00 url(background.gif) No-repeat fixed 0 0;

The syntax is Background: Color Image repeat attachment position;

You can omit one or more attribute values. If this attribute value is omitted, the default value of the browser is used. The default value is:

Color: transparent
Image: None
Repeat: Repeat
Attachment: Scroll
Position: 0% 0%
Fonts)
The font attributes are as follows:

Font-style: italic;
Font-variant: Small-caps;
Font-weight: bold;
Font-size: 1em;
Line-Height: 140%;
Font-family: "lucida Grande", sans-serif;
It can be abbreviated as: Font: italic small-caps bold 1em/140% "lucida Grande", sans-serif;

Note: If you are short for font definition, you must at least define the font-size and font-family values.

List (lists)
To cancel the default dot and serial number, you can write list-style: none ;,

The list attributes are as follows:

List-style-type: Square;
List-style-position: inside;
List-style-image: url(image.gif );
Can be abbreviated as: List-style: square inside url(image.gif);]>

In general, CSS is used to set the font attributes as follows:

Font-weight: bold;
Font-style: italic;
Font-varient: Small-caps;
Font-size: 1em;
Line-Height: 1.5em;
Font-family: verdana, sans-serif;

But you can also write all of them to one line:

Font: bold italic small-caps 1em/1.5em verdana, sans-serif;

Really good! Only one note: this shorthand method takes effect only when both the font-size and font-family attributes are specified. Also, if you do not set font-weight, font-style, and font-varient, they will use the default value, which should be noted.

If you want to build a fixed-width webpage and make the webpage horizontally centered, it is usually like this:

# Content {width: 700px; margin: 0 auto}

You will use <Div id = "content"> to enclose all elements. This is very simple, but it is not good enough. This effect will not be displayed in earlier versions of IE6. Change CSS as follows:

Body {text-align: center }# content {text-align: Left; width: 700px; margin: 0 auto}

This will center the webpage content, so the content is added
Text-align: left.

Vertical alignment can be easily implemented using tables. You can set the table unit vertical-align: Middle. But this is useless for CSS. This attribute is useless if you want to set a navigation bar to 2 em and center the navigation text vertically.

What is the CSS method? By the way, set the Row Height of the text to 2em: Line-Height: 2em.

9. Position CSS in the container

One advantage of CSS is that one element can be located at any time in a container. For example, for this container:

# Container {position: relative}

In this way, all elements in the container are relatively located, and can be used as follows:
<Div id = "Container"> <Div id = "navigation">... </div>
If you want to locate at 30 to the left and 5 to the top, you can do this:

# Navigation {position: absolute; left: 30px; top: 5px}

Of course, you can also do this:
Margin: 5px 0 0 30px
Note that the order of the four numbers is: Top, right, bottom, left. Of course, sometimes the positioning method is better than the margin method.

10. Background Color directed to the bottom of the screen

CSS cannot control the vertical direction. If you want to direct the navigation bar to the bottom of the page like the content bar, It is very convenient to use a table, but if you only use this CSS:

# Navigation {Background: Blue; width: 150px}

A shorter navigation bar will not go straight to the bottom, and it will end when the half-way content ends. What should I do?

Unfortunately, you can only use spoofing to add a background image to the shorter column. The width is the same as the column width, and the color is the same as the Set background color.

Body {Background: url(blue-image.gif) 0 0 repeat-y}

In this case, EM cannot be used as the unit, because in this case, once the reader changes the font size, this trick will reveal the filling, and only PX can be used.

Related Article

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.