[Original] summarizes the reusable functions of this project.

Source: Internet
Author: User

This. Net project is coming to an end. I want to extract public reusable functions. One is to share with you, and the other is to accumulate my own experience.

 

First, share a Javascript file named config. JS, which is put under the project and can be used for the entire project.

 

The Code is as follows:

 

// Shield the right-click menu. This is very important for a professional system </P> <p> document. oncontextmenu = function () {return false ;}</P> <p> // The textcounter function calculates the number of digits that the current user can enter based on the characters entered by the user, </P> <p> // It is user-friendly in terms of customer experience, when the number of words exceeds the limit, the corresponding words are automatically intercepted. </P> <p> // here, field is the textbox that allows the user to input data; maxlimit is the maximum number of words that can be entered </P> <p> // labelstr is a label or Textbox, which displays the number of words that can be entered dynamically, </P> <p> // we recommend that you set it to // read-only </P> <p> function textcounter1 (field, maxlimit, labelstr) </P> <p >{</P> <p> If (document. getelementbyid (F Ield ). value. length> maxlimit) </P> <p >{</P> <p> document. getelementbyid (field ). value = document. getelementbyid (field ). value. substring (0, maxlimit); </P> <p >}</P> <p> else </P> <p >{</P> <p> document. getelementbyid (labelstr ). value = maxlimit-document. getelementbyid (field ). value. length; </P> <p >}</P> <p> // calculate the number of characters in the textbox, overload of the above function </P> <p> function textcounter (field, maxlimit) </P> <p >{</P> <p> If (document. getelementbyid (field ). value. length> maxlimit) </P> <p >{</P> <p> document. getelementbyid (field ). value = document. getelementbyid (field ). value. substring (0, maxlimit); </P> <p >}</P> <p> else </P> <p >{</P> <p> document. getelementbyid ("remlen "). value = maxlimit-document. getelementbyid (field ). value. length; </P> <p >}</P> <p> // a small window is displayed, and the address bar, menu bar, the status bar is blocked, and the window size is also required. <br/> functio N dblclickfunc () {<br/> window. open ("messageemp. aspx "," newwindow "," Height = 500, width = 650, Top = 100, Left = 220, toolbar = No, menubar = No, scrollbars = No, resizable = Yes, location = No, status = No "); <br/>}</P> <p> // select all check boxes <br/> function selectall (OBJ) <br/>{< br/> var thetable = obj. parentelement. parentelement. parentelement. parentelement; <br/> var I; <br/> var J = obj. parentelement. cellindex; </P> <p> F Or (I = 0; I <thetable. rows. length; I ++) <br/>{< br/> var objcheckbox = thetable. rows [I]. cells [J]. firstchild; <br/> If (objcheckbox. checked! = NULL) objcheckbox. checked = obj. checked; </P> <p >}< br/>}</P> <p> // select the value of the row selected by the checkbox <br/> function checkchanginfo () <br/>{< br/> var I; <br/> for (I = 0; I <document. all. gvgoodsclassinfo. rows. length; I ++) <br/>{< br/> var cb = document. all. gvgoodsclassinfo. rows (I ). cells (0 ). children (0); </P> <p> If (CB. checked) <br/>{< br/> document. getelementbyid ("txtmodel "). value = document. all. gvgoodsclassinfo. rows (I ). cells (1 ). innertext; <br/> document. getelementbyid ("txtremark "). value = document. all. gvgoodsclassinfo. rows (I ). cells (2 ). innertext; <br/>}< br/>

 

 

 

 

If there are deficiencies, you can raise them. More project summaries will be updated in the future.

 

 

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.