JavaScript strings are commonly used in custom functions, loading CSS etc.

Source: Internet
Author: User

Go to the section behind the string # http://localhost:8090/admin/activity.html#list = ListString.prototype.hash = function () {var index    = This.lastindexof ("#"); Return Index < 0? "": this.substring (index);};/    /String width Chinese characters are counted as 1 alphanumeric String.prototype.width = function () {var c = 0, Inc;        for (var i = 0, n = this.length; i < n; i++) {inc = This.charcodeat (i) < 256? 0.5:1;    C + = Inc; } return C;}    String.prototype.mb_substr = function (w) {var c = 0, Inc, I;        for (i = 0, n = this.length; i < n && c <= w; i++) {inc = This.charcodeat (i) < 256? 0.5:1;    C + = Inc; } return this.substring (0, i);}    Returns the maximum value of an array of integers Array.prototype.max = function () {var max = this[0];        for (var i = 1, n = this.length; i < n; i++) {if (This[i] > max) {max = this[i]; }} return max;};/    /Remove tags in HTML <div><p>...function strip_tags (HTML) {var div = document.createelement ("div"); Div.innerhtml= html; Return (div.textcontent | | div.innertext | | "");}    Current month 201806function get_yyyymm () {var date = new Date ();    var month = Date.getmonth () +1; Return (Date.getyear () + 1900) + "" + (month<10? ") 0 "+month:month);} Introduce CSS (JQUERY-UI.CSS) to head >link:first-child//load CSS before all <link> tagsfunction css (href) {var li    NK = document.createelement ("link");    Link.type = "Text/css";    Link.rel = "stylesheet";    link.href = href;    var dom = document.head.querySelector ("link"); Document.head.insertBefore (link, DOM);}

  

JavaScript strings are commonly used in custom functions, loading CSS etc.

Related Article

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.