Experience a few recommend _javascript skills

Source: Internet
Author: User
Tags html tags
The following is my development encountered problems and experience, spent some time debugging, posted out to avoid everyone less detours, if there are errors welcome correction, continuous update ing
XML files as much as possible to utf-8 encoding, gb2312 some words are not stored, such as ©, even if you can save also need conversion, more trouble, Utf-8 also conform to international norms
CSS: hover this pseudo class, if placed in: visited before it will fail
<a> tags if there is no href attribute, all the pseudo classes on its CSS such as: hover are invalidated
JS file with Document.wirte ("<script language= ' javascript ' src= '" + file + "' ></" + "script>" in the form of references, Its file relative path is the path to the HTML that references that JS.

For example: a.htm references x\b.js,b.js reference x\c.js, file should be x\c.js instead of direct path b.js relative c.js, and @import,url () references in CSS do not have this problem

In the page, sometimes the talbe width is set to 100% the right also leaves a scroll bar blank, please set <body style= "Overflow:auto" >
For commonly used pictures do not use IMG tags, use <span><a> and CSS to specify their background and width, for the dynamic (moving to the background), the use of <a> best, do not need to write additional code, as long as the use of pseudo-class: hover is good, Using CSS benefits is a change in all changes, which can be well used in the application of skin change
@font-face {
font-family:comic;
Src:url (HTTP://VALID_URL/SOME_FONT_FILE.EOT);
}
Defines a font name that is not locally called <span style= "font-family:comic;font-size:18pt>aa</span>
Several CSS
div {overflow:hidden;text-overflow:ellipsis;}
td {Vertical-align:middle;}
To force an overflow to occur and to apply the ellipsis value, the author must set the White-space property value of the object to nowrap.
If there is no line-breaking opportunity (for example, the width of the object container is narrow and there are long lines of text without reasonable breaks), nowrap may overflow without application.
In order for the ellipsis value to be applied, this property must be set to an object with an unreachable region. The best option is to set the overflow property to hidden
Firefox's document.createelement does not support HTML tags in content, nor does it support innertext, but supports innerHTML to specify its contents with innerHTML
In the. NET control, the width of the DropDownList under Firefox is not shaded, and you need to define style= ' width:10px directly;
Firefox in the CSS cursor does not support hand, using pointer instead
The scroll bar in the IFRAME needs to be set style= ' Overflow:hidden ' in the IFRAME tag, not just in the body, but in Firefox.
When Onpropertychange an event, note that using Event.propertyname to change event filtering on the property, when setting this event, has actually changed the Onpropertychange this property, so it will automatically execute once
The support version for XSL in js5.6 is lower, as the document function does not support
Slice function is slower than direct looping to get an array fragment
NextSibling when you get the next object, be aware that there are no spaces between the two nodes, otherwise it's easy to get the right objects
CreateTextFile must specify the third argument to be true when there is Chinese, otherwise it cannot be written in Chinese, as write write times are wrong
Use ADODB.stream when saving Chinese text, do not use FSO because the FSO does not support UTF-8 format
2. Pseudo class of anchors
Our most commonly used is the pseudo class of 4 type a (anchor) elements, which represent dynamic links in 4 different states: link, visited, active, hover (unlinked links, visited links, activation links, and mouse resting on links). We define each of these different effects:
A:link{color: #FF0000; text-decoration:none}/* links not visited * *
A:visited{color: #00FF00; text-decoration:none}/* visited links * *
A:hover{color: #FF00FF; text-decoration:underline}/* mouse on the link * *
A:active{color: #0000FF; text-decoration:underline}/* activation Link * *
(In this example, the link is not accessed when the color is red without underlining, access is green without underlining, when activating the link is blue and underlined, the mouse on the link is purple and underlined)
Note: Sometimes the link before the mouse point to the link is effective, and link access after the mouse again point to the link is not effective. This is because you put a:hover in front of the a:visited, so that because of the high priority behind, when access to the link after the neglect of the a:hover effect. So according to the stacking order, when we define these link styles, we must write them in the order of a:link,a:visited,a:hover,a:actived.

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.