Generally, we obtain the event object as follows:
CopyCode The Code is as follows: function getevent (event ){
Return event | window. Event // ie: window. Event
}
If no parameter exists, you can also write it as follows (non-ie: The event object
1. Use JavaScript to redefineWindow. onbeforeunload () event
Define a function in JavaScript.
Function window. onbeforeunload () {alert ("Close Window ")}
The Alert () event will be executed before closing the window. You can also decide whether
CopyCode The Code is as follows: exceloperation = function (){
This. oxl = NULL;
This. owb = NULL;
This. osheet = NULL;
This.xls rowcount = 0; // total number of records
This. excelfilename = NULL;
This. currentrow = 2; // current row
/**
* Obtain
What is JavaScript?
Javascript is an object-and event-driven client scripting language.
Javascript was originally designed to verify the correctness of HTML form input.
Javascript originated from Netscape's livescript language.
JavaScript
Javascript is a non-typed and interpreted language.
Case Sensitive
HTML is case insensitive
Ignore space characters, tabs, and line breaks (except keywords, variables, and regular expressions)
";" Semicolon selectable
// Single line comment
/* Multi-
Call entry
A chained call exists in async. the Go method and async. the chain method has two portals, which are essentially the same, but async. the chain method does not provide initial parameters when calling, but async. the Go method provides
Let's take a look at the effect.The code is simple, but the setTimeout () function of JavaScript is used.HTML used"
CopyCode The Code is as follows:
Src = "dg8.gif" name = "HR2"> Src = "dgc.gif" name = "C"> Src = "dg8.gif" name = "Mn1"> Src =
1. Create a base class
First, consider the polygon class. Which attributes and methods are required? First, you must know the number of edges of a polygon. Therefore, you should add the integer attribute sides. What else is required for polygon?
JS does not provide the so-called class inheritance. It is said that this inheritance method should be added to 2.0, but it will certainly take n years for all browsers to achieve the 2.0 feature. Yesterday I saw a video from crockford, which
Class StructureFirst, let's build a shelf and list all the variables that need to be used. We need an array to save the callback function list. A flag is required to indicate whether the asynchronous operation has been completed. You can also learn
Transfer callback
The first thing we need to consider is how to pass the callback entry. In the most traditional XHR calls, the callback function will be passed to the asynchronous function as the last parameter:
Copy codeThe Code is as follows:
Let's take a look:
OEle = document. all. aaa; // There is an aaa object, but we don't know how long it is, so we can't operate on it. therefore, we need to judge the length first. as follows:
If (oEle. length) {} else {};
In either case, the content
Preface
Javascript is an object-based Dynamic Language. That is to say, everything is an object. A typical example is that a function is considered a common object. Javascript can implement object-oriented programming through certain design patterns.
Copy codeCode: parseInt ("Hello", 10); // return NAN
ParseInt ("110", 10); // return 110
Therefore, the simple method to determine whether a string is a number is to use isNaN (). If true is returned, the string is not a number; otherwise, it is a
When you enter an iframe {A} from the main window for the first time, the data displayed in {A} is new, at this time, I ordered another iframe for short {B}. Here, the data of {B} is also new. I processed some logic in {B, for example, if you add
For example, we define a Classroom object. Here we define an event. When the number of persons in the Classroom increases by over 60, an event onFull is triggered. The specific definition is as follows:
Copy codeThe Code is as follows: var
The specific solution is as follows:
1. The clientHeight, offsetHeight, and scrollHeight attributes of the document. body object under IE and FF.ClientHeight
In IE and FF, this attribute is no different. It refers to the visible area of the browser,
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