Artjs (original) Working with documents

Source: Internet
Author: User

/*
Method directory;
"IE7 8 does not support the trim () method of making up"
"Stop Bubbling"
"Digital thousand-cent"
"The Alternative to JS operation (js3.3/1.1 not equal to 3 floating point calculation has a bug)"
"Date plus minus days, two dates subtracted"
"Renders a div with a triangle underneath the element"

"Artjs.msg"

"Table implementation-like Excel search"
"Table Sort"
"Make up layer.msg can only use one at a time, the second will cover the first effect"
*/

"IE7 8 does not support the trim () method of making up"

var test = "abc"; Test.trim ();

"Stop Bubbling"

/*
"stop bubbling"
for event bindings for dynamic elements (such as live), Stopmaopao has no effect and needs to use return false within the method. = = = " This is the wrong understanding!!!!!! The Stopmappao is valid for .
var a = null;
A = 7;
var b = a | | 8;//7
var c = a! = null? A:8;//7
Alert (b + "_" +c);

Event = Event | | window.event; The reason is that the original event = Window.event | | event; Invalid result.

x | | Y is the equivalent of a 3-dollar expression.


With bubbling, bubbles are terminated using the same events inside the bubbling element, only bubbling to the current element. So the inner element of live does not bubble to document function (the onclick can function directly on the element). However, it can be used, on (delegate), so that event snooping does not bubble to the document object but bubbles to the element that uses bubbling. {Live is the monitoring of dynamic element events is placed on document; delegate is the listener of the dynamic element event is placed on the specified object, and the higher version of jquery is recommended to use on}

Note for use: Theevent parameter needs to come from a parameter that is bound to use the method of terminating bubbling ;
Situation 1-> <input type= ' button ' value= ' buttons ' onclick= ' Btnclick (event, other parameters) '/>
Situation 2-> <input type= ' button ' value= ' buttons ' id= ' testbtn '/> $ (' #testbtn '). Click (Funtion (event, other parameters) {})
The situation 3-> $ (' #testbtn '). Live (' click ', Function (event, other parameter) {logical Code;})

return false to terminate bubbling. But it's not just bubbling, so try not to use return false
*/

Provide two scenarios to use bubbling, click on div to stop bubbling, click Blank to disappear.

Artjs.setstopmaopaobasicclass (); Artjs_stopmaopao Stop bubbling, Artjs_hideafterdomclick click Dom to hide; Artjs_removeafterdomclick Click Dom to remove

"Digital thousand-cent"

<input type= "text" name= "test" value= "" onkeyup= "$ (This). Val (Artjs.tothousandsplit ($ (this). Val ()));"
Onblur= "$ (This). Val (Artjs.tothousandsplit ($ (this). Val ())); $ (this). Val (Artjs.clearlastdom ($ (this). Val ())); "/>

"The Alternative to JS operation (js3.3/1.1 not equal to 3 floating point calculation has a bug)"

alert (3.3/1.1); JS calculation has a bug. ARTJS.D (3.3,1.1);

"Date plus minus days, two dates subtracted"

var now = new Date ();
var y = now.getfullyear ();//Gets the year in the time
var m = now.getmonth () +1;//gets the month of the month 0-11 so, you need to add 1.
var d = now.getdate ();//Gets the date
Convert to a format that can be used to add, subtract, and process the year-month-day
var Formatnow = y + "-" + M + "-" + D;
var result = Artjs.dateadddays (Formatnow, 11);
alert (result);
Artjs.twodateminus (' 2016-09-30 ', ' 2016-10-1 ')

"Renders a div with a triangle underneath the element"

<input type= "button" name= "name" value= "onclick=" Artjs.showwithtridiv (this, ' test ') "/> Reliance on Artjs.setstopmaopaoafterdomclickremove ();

"Artjs.msg"

Artjs.msg (' Make up the layer.msg can only appear a deficiency ', 3000)

Artjs (original) Working with documents

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.