DHTML provides two ways to add, insertadjacenthtml and insertAdjacentText
insertAdjacentHTML Method: Inserts an HTML tag statement at the specified location.
Prototype: insertadjacenthtml (Swhere,stext)
Parameters:
Swhere: Specify where HTML tag
The syntax for the Replace method is:stringobj.replace (Rgexp, ReplaceText) where Stringobj is a string, and reexp can be a regular expression object (REGEXP) It can also be a string, ReplaceText is an alternative to a found string ... To help you
The usage of substr,substring,indexof,lastindexof in JS
1.substrSUBSTR (start,length) indicates that the length of a string is intercepted from the start position.
var src= "Images/off_1.png";Alert (SRC.SUBSTR (7,3));
The pop-up value is: off
Copy Code code as follows:
function Window.onunload () {alert (' This is what you want to do, after closing the page! '); Location = ' sessionclear.aspx '; }
function Window.onbeforeunload () {alert (' This is what you want to do, before
Copy Code code as follows:
//Description: JavaScript addition results will be error, in two floating-point number added when it is more obvious. This function returns a more precise addition result.
Call: Accadd (ARG1,ARG2)
return value:
Solve the problem of "Introducing JS file IE6 Error"
Problem Description:
The page introduces a JS file that defines a function or object, and then calls a function or object in the page, IE6 the "syntax error" or "Missing object". In ie6+ or IE7
Copy Code code as follows:
var obj = document.getelementbyidx_x ("Testselect"); Positioning Idvar index = Obj.selectedindex; Select index var text = Obj.options[index].text; Selected text var value = Obj.options[index].value; Checked value
Background:
Today in doing a task, using jquery Ajax to pass a long string of characters, in the background of the validation has been unsuccessful, tangled with me (that string is randomly generated, expertise). Check the morning, the original is
In the URL pass parameter, there are some special characters, these symbols in the URL is not directly passed, if you want to pass these special symbols in the URL, then use their code.Some URL special symbols and encoded hexadecimal values are
Today to do a small print web page function, directly call Window.print (), but printed out, the font is always narrowing a number, can not find the reason ...
Later try to use an IE print control, but only support ie a little disgusting, can only
Let's talk about the basic usage of window.showmodaldialog.
ShowModalDialog () (IE 4+ support)showModelessDialog () (IE 5+ support)The window.showModalDialog () method is used to create a modal dialog box that displays HTML content.The
First, JS delay loading
The code is as follows:
Copy Code code as follows:
Second, JS finally loaded
Insert the following code where you want to insert JS:
loading...
Of course, that loading ... You can switch to
Copy Code code as follows:
There are several other ways:
Copy Code code as follows:
var test=88888.234;
Alert (test.tofixed (2));
float data rounded to 2 decimal places;function To2bits (FLT) {if (parsefloat (flt) = =
With the changes in the times, more and more sense of the importance of JS, JS not only can do Web pages (such as ext frame), can also do some web effects, these special effects not only compatible with the PC, but also compatible with the mobile
Window.opener=null;window.close (), only support IE6 does not support IE7 issues
Open a new window and close this window without ejecting the prompt before you close the windowfunction Openwin () {window.open (' login.jsp ', ', ', '
I am keen to answer the technical questions of netizens, so in Baidu know column founded the "Kick 543" team.
Since the inception of the team, every day a large number of netizens to apply to join my team, so the new members of the audit team became
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