As a web designer, your site has exactly the same performance in a variety of browsers as the goal of many people, however, this is a goal that can never be truly achieved, and many people think that perfect cross-browser compatibility is not necessary, although it is true, in many cases, an approximate compatibility is easy to implement, This article is about a variety of Cross-browser
BackgroundAs MVVM matures, building a web App with jquery is now obsolete, and using jquery to write more code to control DOM values, assignments, binding events, and so on, MVV from the bottom up to support the above operations, allowing programmers to get from the original complex, The free repetition of the code allows programmers to focus more on the implementation of the business, the interaction of the data, and greatly reduces the amount of code the programmer needs to write.Over the year
JavaScript implements the perfect compatible multi-browser replication functionality Code
These two days in the Web front-end, encountered the requirements through JS to achieve the function of text replication. After a test, finally realized out, the need for small partners can refer to.
Share a piece of code that uses JavaScript to replicate functionality, compatibl
the operation. Returns true if the first parameter is greater than or equal to the second argument.
( )
[If! (IE 7)]
subexpression operators. Used in conjunction with the Boolean operators to create more complex expressions.Sub-expression operator. Used in with Boolean operators to create more complex expressions.
[If (GT IE 5) (LT IE 7)]
The AND operator. Returns true if all subexpressions evaluate to TrueAnd operator. Returns true if all sub-e
made a custom right-click menu function, and get the selected text content related to the record together.
Online access to try a lot of ways to choose a more concise way to achieve, the code is very small, the details of the adjustment found that there are IE8 compatibility issues, and after the optimization of the data, can be perfectly compatible with IE8, but note that the jquery version must 1.7+, I use the 1.8.3 version.
Here I to the
Add a Google browser-specific kernel attribute style to the HTML or body (or you can add a CSS selector if you need to set a small text font object) such as the following CSS code:Html,body{-webkit-text-size-adjust:none;}Or. Divcss5{-webkit-text-size-adjust:none;}Note: If you use this property, the browser font will not be able to use the Zoom out function! (Just hold down the CTRL key to scroll up and down
var date = new Date (' 2016-11-11 11:11:11 ');
document.write (date);
Recently in writing a time to judge a script, you need to convert the fixed string time to the timestamp for comparison, in doing the personal habit of using chrome as a debugging tool, after the basic code is complete, all normal;
Access with other browsers, well, IE is not compatible with Safari, returning the error "Invalid Date."
Think of the problem is a string format, cha
DOCTYPE HTML>HTMLLang= "en">Head> MetaCharSet= "UTF-8"> title>title> style>Div{width:500px;Height:20px;Border:2px solid Red; } style>Head>Body>inputtype= "button"value= "button"ID= "BT"/>DivID= "DV">Wow, that's great.Div>Scriptsrc= "Common.js">Script>Script> //set any text content in the middle of a label functionSetinnertext (element, text) {//determine if the browser supports this property if (typeofelement.textconten
Use the link as follows. After clicking in Chrome, the behavior is expected, but a new tag card will be opened under IE (according to reference, Firefox has the same problem).After looking for information, found to be resolved as follows.Block browser default event via onclick: or direct: The reason is that three browsers have different processing order for three properties.Chrome Order: onclick, href-and targetIE and Firefox order: href---target---
interaction of a parent-child page relies solely on the parent keyword (which, in the previous approach, relies not only on parent, but also on Contentwindow, window, and other indeterminate keywords, and most importantly, the support of the parent is very good)
2.window object unification, reduce the request for each use of the reference chain, improve the running speed
3. The most important point: The code is much easier to write.
The above is a small set to introduce the JavaScript IFRAME
Now more and more browsers, such as IE, Firefox, Chrome, Safari and so on, so now to achieve a JS copy content to the Clipboard small function is not so easy.
in the Flash 9 era, there is a program that kills all of the browser's JS copy content to the Clipboard :
This program is one of the most popular methods: the famous clipboard copy solution utilizes a clipboard.swf as a bridge to copy content to the Clipboard.
The principle is: Create a hidden Flash file, and give the Flash variable fla
Compared with Flash, the new technology using HTML5 can improve the loading speed of the program. However, in the current situation, HTML5 feature support is not high, the availability of plug-ins is really narrow. For example, the new features I use in Plug-ins are:
Multiple properties of the
File and FileList APIs
XMLHttpRequest2 's upload and onprogress.
FormData
Take file, IE9 are not supported, so in the current environment IE series
The Perfect browser-compatible
HR:
height:1px;
Border:none;
border-top:1px solid Black;
margin:0;
*margin:0 0-14px 0;
Float:none;
*float:left;
Display:block;
The 1.hr element is a block-level element that is a box that has border
2. Height:
sizeAnd
Style.height.IEAnd
FirefoxThe size is interpreted and calculated differently, so it's best not to
sizeUse
Height, but there will be a border
Box, so wi
For web development, you will often encounter the distance between the browser's scroll bar and the top and bottom, and then perform corresponding processing. The authors will share with you how to use js to obtain the height of the browser's scroll bar from the top and bottom of the browser. This is compatible with both ie and firefox.
First, we need to know two definitions:
The height of the scroll bar fr
In a real-world Web application, we may encounter a "need to qualify a specific computer or user to use the system" issue.As a general rule, the most likely use of ActiveX controls is to implement them, but this scenario is only applicable to IE. In order to be compatible with different browsers, such as Firefox, we need to consider a more general approach. This method we can refer to "in many sites, will be a link in the page somewhere to start QQ di
#条件声明 (explained in detail in another article) is also the most common way to solve IE compatibility#对于不同版本的IE相应的CSS规则, is also an alternative way.IE8 and/or next: After adding the 9 (\9) attributeIE7 or later: Add a property before adding *IE6: Add before attribute _. box {Background:gray;/* standard */background:pink\9;/* IE 8 and below */*background:green;/* IE 7 and below */_bac Kground:blue; /* IE 6 */}#条件声明里面, add the This method was invented by Paul Irish, using the corresponding IE class
This article describes the JS compatible PC-side browser and has a variety of pop-up tips for mobile phone-side floating-layer control. Share to everyone for your reference. Specifically as follows:
Full instance code click here to download the site.
Usage
or call it in jquery:
Inheriting class alert and confirm hints (in jquery mode):
Html:
Js:
$ (' #btn
For the most part, it is possible to use the ActiveX control method, but this scenario applies only to IE browsers. In order to be compatible with different browsers, such as Firefox, we need to consider a more general approach. This method we can refer to "in many sites, will be in a page somewhere to a link to directly start QQ to chat." This method enables the Web system to invoke an EXE file on the client computer (provided that the required EXE a
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.