This is mainly used in form fields, so my experiment here is only for form fields. In the child element of form, search for the first field that is not a hidden field cyclically, and then use the focus method to obtain the focus. (Haha ^ _ ^, very
CopyCodeThe Code is as follows: function gethttprequest ()
{
VaR xhr = false;
If (window. XMLHttpRequest)
Xhr = new XMLHttpRequest (); // browsers except IE
Else if (window. activexobject)
{
Try
{
Xhr = new activexobject ("msxm12.xmlhttp");
remaining words in the JS computing text field note: displaysparenumber (this, 10) and 10 indicates the content length you have defined.
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to
Speak nonsense,
Code Come up:
Copy code The Code is as follows:
Document. onkeydown = function ()
{
VaR eventutil = {};
Eventutil. getevent = function (){
If (window. Event) {return window. event ;}
Else {return eventutil. getevent. Caller.
1. ArgumentsAn array corresponding to the arguments passed to a function.
In a function, the identifier arguments references a special attribute of the arguments object. You can obtain the parameter values passed to the function by number (rather
// Binary search for the forgetful recursive version
CopyCode The Code is as follows: function binary_search (ARR, target, low, high ){
If (low VaR min = (low + high)/2;
If (target> arr [Min])
Return binary_search (ARR, target, min + 1, high
Copy codeThe Code is as follows: var example = new Fx (element, // element
{
Form :{
// The style before the animation
// Color: "# 00f ",
},
To :{
// Target Style
Color: "# 00f ",
"Background-color": "#5f5 ",
Opacity: 0.9,
},
// Linear
hexadecimal conversion 10 hexadecimal hexadecimal hexadecimal 10-digit encoding and conversion Number character character numbers available in HTML 22221; indicates encoding character encoding table name range quantity
Each object has a hidden object attribute that is used to point to its parent object (a function for constructing the object). This is called a parent object or an implicit object ), and inherit from its attributes and methods [function object has
Core code:
Copy codeThe Code is as follows :/**
* Jscript. string package
* This package contains utility functions for working with strings.
*/
If (typeof jscript = 'undefined '){
Jscript = function (){}
}
Jscript. string = function (){}
/**
* This
Differences between textContent and innerText
IE has an innerText attribute, and FF has a textContent attribute. Many of the scripts previously written to IE cannot find the innerText attribute under FF. Therefore, we recommend that you use
About 70% of the content below is from http://www.quirksmode.org/js/this.html, and another 30th is my thoughts on this article. Hope to help people in need...
First, let's look at a typical question about the this keyword:Copy codeThe Code is as
Usage:
1. Set cookie
Copy codeThe Code is as follows: var cookie = new JSCookie ();
// Normal settings
Cookie. SetCookie ("key1", "val1 ");
// The expiration time is one year.
Var expire_time = new Date ();
Expire_time.setFullYear
Copy codeThe Code is as follows :/*
* Function name: DateUtil
* OPERATOR: yithcn
* Function Description: Date Functions
* Instructions:
* Creation date: 2010.10.14
*/
Var DateUtil = {};
DateUtil. base = 60*60*24*1000;
DateUtil. Add = function (num,
For example:
Copy codeThe Code is as follows: // code 1
Function Pig (){}
Var pig = new Pig ();
Alert (pig instanceof Pig); // => true
Function FlyPig (){}FlyPig. prototype = new Pig ();Var flyPig = new FlyPig ();Alert (flyPig instanceof Pig); // =>
Demo address: http://demo.jb51.net/js/mouse/index.html
Packaging http://www.jb51.net/jiaoben/32434.html
This was written when I was bored. First, let's look at the effect (the UI is ugly ):
Note: The red button points 100 and the blue button points
This article will answer the last question about pseudo arrays mentioned in the general circular Traversal method forEach in javascript.
What is a pseudo array?
You can use Array. prototype. slice to convert an object with the length attribute to 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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service