Most of the time, when browsing a Web page, we need to consider the situation where users close the window in a few hours, especially when the user has important data that has not been saved, it is necessary for our program to remind users. In this case, we can use javascript window. onbeforeunload () to prevent users from closing the window. See the following example:
In this way, when you press the close button, the following window will pop up (
javascript| Control | Calendar
Web Calendar control A lot of online, the function is also very powerful, but most of them do not support Firefox, their leisure wrote a, has the following characteristics:
Characteristics:
First, support Ie6,firefox
Second, support Chinese and English calendars, free to expand other languages
Third, when you encounter the Select D
JavaScript does not prompt to close the current page window, compatible with IE/Firefox/chrome (close the current page window without confirm by JavaScript, support all browsers)
Tests passed in IE7/Firefox 3.0/Google ChromeClosedemo.htmCopyCodeThe Code is as follows:
note: " if you are using the
for Layerx properties.Note: IE and FF positioning there is a 1px difference, in fact, ie positioning starting from 0, ff positioning starting from 1, FF will always be bigger than IE 1px, need to deal with the actual situation.Offsetleft: This property is not a property of the event object, but is all of the DOM object, which represents the position of the DOM object in the "closest to the object in the DOM object's hierarchy, set the parent of the position", although that is true, However, dif
It is very easy to use javascript to determine whether the user clicks the Left or Right button. You only need to add the onmousedown event to the object and use the javascript e. button value to determine whether the user clicks the event. The following is an example.
Document. onmousedown = judgeMouseButton; function judgeMouseButton (e) {var e = window. event | e; // obtain the event object var value =
In Web development and design, we often encounter compatibility issues between various browsers. Among them, IE and Firefox are the most common. For example, in IE, XmlHttp. the content of the send (content) method can be empty, while firefox cannot be empty. send ("") should be used; otherwise, error 411 may occur. The following describes how to make Firefox ful
Javascript
1. Object Problem
1.1 Form ObjectExisting issues:Existing code this gets the form object through the Document.forms ("FormName"), so that the use in IE can be accepted, MF cannot.Workaround:Instead, use as the subscript operation. Change to Document.forms["FormName"]NoteThe above used as the formname in the subscript operation is ID and name
1.2 HTML ObjectExisting issues:In IE, the ID of an HTML object can be used directly as the subordina
Article Title: Firefox and Chrome run JavaScript almost as fast. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The test results of JavaScript efficiency detection on SunSpider show that the execution speed of the latest Goog
JavaScript obtains the coordinates when the mouse moves (compatible with IE8, chome Google, Firefox), ie8chome
JavaScript obtains the coordinates of the mouse movement (compatible with IE8, Google, Firefox, and Opera ).
Directly copy the file into an html file to run it.
We have prepared an online demonstration for you
Different browsers have different support for Javascript, and different versions of browsers have different support for JavaScript versions. I will not elaborate here.
Javascript has now supported Dom and BOM. Let's talk about a problem encountered in Firefox (Version 3.0 ):
See the following HTML:
Code highlighti
2009
-
04
-
11 Compatible with IE and Firefox, It is set as the home page and the favorite Javascript
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Function
Addcookie (){
//
Add to favorites
If
(Document. All ){Window. External. AddFavorite (
'
Http://taotao.wsyren.com
'
,
'
Niu Ba
'
);}
This article mainly introduces javascript-compatible methods for Firefox to retrieve images in width and height, and involves related javascript Image operations, for more information, see the examples in this article. Share it with you for your reference. The specific implementation method is as follows:
Get Image width and heightScript function newimage
Compilation of Javascript IE and Firefox compatibility [zt]
Internet Explorer is replaced by IE and Mozzila Firefox is replaced by MF.
1. document. form. item Problems(1) existing problems:Many statements such as document. formName. item ("itemName") exist in the existing code and cannot be run in MF.(2) solution:Use document. formName. elements ["elementName"](
previously suppressed the notification, then the browser will not ask the user again, the Notification.requestpermission () method is invalid)Notification.requestpermission (function(status) {if(Status = = = "Granted") {//user allows varInstance =NewNotification (title, {body:msg, Icon:icon URL}); Instance.onclick=function() {window.focus (); Window.location.href=Clickurl; }; Instance.onerror=func
1.onkeypressonkeydown differencesThe onkeypress event occurs when the user presses and releases any alphanumeric keys. However, the system buttons (for example: arrow keys, function keys) cannot be identified.The onkeydown event occurs when the user presses any keyboard key, including the system button. The captured keycode do not differentiate between letter sizes, but onkeypress.IE6 's onkeypress will accept the "carriage return event", and OnKeyDown will not acceptIE8 's onkeypress will not a
xml| Advertising
Recently updated the home page ads, ASP. NET advertising control is easy to achieve this, but the homepage is a static page, Lenovo advertising control principle decided to use javascript+xml to achieve this aspect of configuration, update the ads as long as the XML can be updated to facilitate the advertising rotationThe XML structure is as follows==
JScript files var now = new Date (); var min = now.getseconds (); var i; if (Min%
Window. close (). You can see that it is used to close the browser window. W3CSchool: The method close () will close the top-layer browser window specified by window. A window can be closed by calling self. close () or only calling close. Only Windows opened through JavaScript code can be closed by JavaScript code. This prevents malicious scripts from terminating users' browsers.
In IE, window. close () tak
The implementation principle of Online Editor (compatible with IE and FireFox) online editor is very useful in our daily project development (such as the news system). It can easily edit articles online, saves FrontPage and other tools. So how does one implement the browser's online editing function? Internet Explorer is required first. After IE5.5, there is an editing status. This editing status is used and javas
This article mainly introduces how to implement the iframe framework value in js, which is compatible with browsers such as IE, firefox, and chrome. this section describes how to use JavaScript to set the value of an iframe framework. We will share this with you for your reference. The details are as follows:
Why are there so many different browsers in the world? Every time I encounter
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.