Copy Code code as follows:
!--here for you to provide three kinds of dynamic loading JS jquery instance code Oh, because jquery is to provide users with convenience, so the use of jquery dynamic loading files as long as a word $.getscript
Before the project to meet the need to enter lowercase amount after the automatic capitalization, after a study, the following code, to share with you, hope to help
Copy Code code as follows:
function Arabia_to_chinese (Num) {
for (i=num.
Copy Code code as follows:
/**
* Lowervalue Minimum value
* Uppervalue Maximum Value
*/
function Selectfrom (Lowervalue, Uppervalue) {
Total Value Range
var choices = Uppervalue-lowervalue + 1;
Return Math.floor (Math.random () *
The effect of this new message hint is used in the company's project, which is mainly used to prompt the user for new messages. The specific implementation code is as follows:
Copy Code code as follows:
var newmessageremind = {
_step:0,
Copy Code code as follows:
var $horizontal = $ ('. Horizontal_screen '); Customizable horizontal screen mode hint style
var $document = $ (document);
var preventdefault = function (e) {
E.preventdefault ();
};
var Touchstart = function (e)
This problem is caused by the running results of a JS program:
Copy Code code as follows:
var i = 0;
function A () {
for (i=0;i}
}
Function B () {
for (i=0;iA ();
}
return i;
}
var result = B ();
The
(Note that Div must be placed in front of JS to the line)
In general, if you bind a DOM object to the same event, only the last one will take effect, such as:
Copy Code code as follows:
document.getElementById ("btn"). onclick =
When the user's page needs to dynamically load an IFRAME,
If the envelope in the src of the IFRAME is encoded incorrectly, it must be coded and then decoded.
Encoding: encodeURI (encodeURI ("contains Chinese strings")
Decoding:
Can say this function, in my understanding of the front of the "greedy snake", it is very difficult to imagine with the beginning of a lot of, of course, this way there is tricky, after all, is to achieve the function, we have to carry out analysis
First, the traditional event modelThere are limitations in the traditional event model.
Inline models are used in the form of HTML tag attributes and are mixed with HTML, which undoubtedly creates problems with modifications and extensions that are
The table has several lines: var trcnt = table.rows.length; (Table is ID)
There are several columns per line: for (var i=0; iTable.rows[i].cells.length;
JavaScript action table:
InsertRow (), DeleteRow (), InsertCell (), Deletecell ()
Sometimes the table's column number is too long, not conducive to user inquiries, so use JS to do a table page, the following is the relevant code
One, JS code
Copy Code code as follows:
Second, the HTML code
Copy Code code
Recently to do a Web page, the specific content is: Top has a title, the bottom is divided into two pieces, the left is a map. And there are two points on the map, click on the two points have a corresponding hint information, display the database
The Date.prototype.toISOString method was added in ES5, ES3 in the document, as follows
This method is not supported in IE6/7/8 and can be repaired in the following way
Copy Code code as follows:
if (! Date.prototype.toISOString) {
The project needs to be the Background browser window full screen, that is, we click a button to achieve the effect of pressing F11 full-screen. In HTML5, the global Wide Web has developed a full screen of the API, you can achieve full-screen effect,
The iframe height is set to the child page height
Copy Code code as follows:
Need to use jquery
$ (document). Ready (function () {
Parent.document.getElementById ("Ifpage"). Style.height = document.body.scrollHeight + "px";
});
This small demo, mainly with box fixed long width for display pictures, the picture into the Imagebox, connected, each change the picture will imagebox style attributes of the margin-left changes, can form the effect of the carousel.
Copy
What is a cookie?
A cookie is a variable that is stored in a visitor's computer. This cookie is sent whenever the same computer requests a page through the browser. You can use JavaScript to create and retrieve a cookie's value.
Examples of
Use JS to replace all characters except numbers and commas
Copy Code code as follows:
Results:
Copy Code code as follows:
345345,345345
Complete code:
Copy Code code as follows:
Several articles have introduced JS debugging series of some basic knowledge, this time garbled brothers for everyone to bring the JS breakpoint and dynamic debugging methods, the need for friends can refer to the
Practice 1 After the lesson that
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