A basic JavaScript technique. It obtains the character string from the left or right according to the character specified in a string. In this example, the email address can be used as an example to obtain the User Name of the mailbox, this instance
In many cases, we need to change these default operations. For example, when clicking a link, we execute some Ajax operations, but we do not want to perform the jump action, so we have this article: block default browser operations.
In fact, this
Class learning in javascript: methods inherited from basic classes
It can also be implemented as follows:
Java
Code
Copy codeThe Code is as follows: function newclass (){
This. firstname = "Frank ";
This. touc = string. touppercase;
This.
First, create two classes. One is used to connect with the data (data layer), and the other is used to associate the previous class with the page (logic layer)
Create a jscsrip. JS File
Code As follows:
Copy code The Code is as follows: function
Push method Add the new element to an array and return the new Length Value of the array.
Arrayobj. Push ([Item1 [item2 [... [itemn])
Parameters
Arrayobj is required. An array object.
Item, item2,... itemn is optional. The new element of the
In actual work, I found that
Program The most complained about the script is that it is difficult to debug the script program, especially when debugging wsh programs such as. vbs, always:
1. Double-click a. vbs file in the resource manager.
2. An
Currently, images are generally used to control rounded corners. This method has its advantages (resulting in smooth rounded corners ). But at the same time, he also requires matching images. If you want to dynamically change the style color of the
Split definition and usage
The split () method is used to split a string into a string array.
Syntax
Stringobject. Split (separator, howator) parameter description
Separator is required. String or regular expression, which separates stringobject
1. Javascript prototype: Prototype requires a constructor to define object members when implementing object-oriented (such as defining a class, methods are attached to the prototype of the constructor.
2. In JavaScript, prototype of the subclass
I also explained a lot about how to learn Dom. I think it is really beneficial.
The following are some examples that I think are better.
1. Level-2 linkage drop-down menu (level-1 is a province, level-2 is a city, and level-1 is required to select a
CopyCode The Code is as follows: // var people = {name: "Xiong", age: 15 };
// Var person = function (user, age ){
// This. Name = user;
// This. Age = age;
// This. Say = function () {alert ("I am" + this. Name + "\ n" + this. Age );}
//}
// Var
There are several methods to build a class in javascript:
1. Factory method
CopyCode The Code is as follows: function createcar (){
VaR car = new object ();
Car. color = "B ";
Car. Length = 1;
Car. Run = function () {alert ("run ");}
Return car;
From cnblogsCodeThe author's code is not compatible with Firefox at will. However, it helps you to learn why the following code is compatible with Firefox. You can compare it to learn more.ArticleFor more information, see the articles published by
In this topic, we will discuss JavaScript testing to check whether the component status and working method meet expectations. We will also introduce a testing method that facilitates the compilation of test cases. The tests mentioned here are of
The following describes how to write JavaScript code in three different places. To achieve this, click the button to bring up the alert warning box.
The first is the most common. The Code is as follows:Html codeJs CodeFunction pop (){Alert
1. prototype chain inheritanceIn terms of prototype chain inheritance, JavaScript is similar to java, c #, and other languages. It only allows single parent class inheritance. The basic method of prototype inheritance is as follows:
Copy codeThe
Let's start with IE. This is the largest user group. If this part cannot be developed, you can say you don't need to do it. Although IE has a Gradient filter, its implementation is very weak compared with other browsers. There is no stop-color
JScript is a case-sensitive language.
The first character must be an ASCII letter (both uppercase and lowercase) or an underscore (_). Note that the first character cannot be a number.The subsequent characters must be letters, numbers, or
Object-oriented and Object-based
Almost every developer has development experience in object-oriented languages (such as C ++, C #, and Java. In traditional object-oriented languages, there are two very important concepts: classes and instances.
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