PHP essay 7-thinkphp OA system JS text box input real-time control word count

Source: Internet
Author: User

Js:

//calculation of remaining words in multi-line text input box        functioncheckmaxinput (obj, maxlen) {if(obj = =NULL|| obj = = Undefined | | obj = = "") {                return; }/ *if (MaxLen = = NULL | | maxlen = = Undefined | | maxlen = = "") {maxlen = 250; }          */           /*var strresult;            var $obj = $ (obj); var newid = $obj. attr ("id") + ' msg ';*/                        $(' #number '). Show (); if(Obj.value.length > MaxLen) {//if the number of words entered exceeds the limitObj.value = obj.value.substring (0, MaxLen);//just remove the extra words.document.getElementById ("msg"). InnerHTML = "Left" + (maxlen-obj.value.length). toString () + "word"; //strresult = ' <a><span id= ' + newid + ' "class=\ ' max_msg\ ' ><br/> Left (' + (maxlen-obj.value.length) + ') word </span></a> '; Calculate and display the remaining words            }            Else {                //strresult = ' <a><span id= ' + newid + ' "class=\ ' max_msg\ ' ><br/> Left (' + (maxlen-obj.value.length) + ') word </span></a> '; Calculate and display the remaining wordsdocument.getElementById ("msg"). InnerHTML = (MaxLen-obj.value.length). toString (); }           /*var $msg = $ ("#" + newid);            if ($msg. length = = 0) {$obj. After (strresult);            } else {$msg. html (strresult); }*/        }        //Erase the left Word reminder message        functionresetmaxmsg () {$ (' #number '). Hide (); }
<textareaname= "Remarks"style= "Background-color: #CDFF9A; height:285px;width:165px;resize:none;"onkeydown= "Checkmaxinput (this,120)"onkeyup= "Checkmaxinput (this,120)"onfocus= "Checkmaxinput (this,120)"onblur= "Checkmaxinput (this,120); Resetmaxmsg ()"></textarea><Divstyle= "position:absolute;top:200px;left:250px"><astyle= "Display:none"ID= "Number">Left<spanID= "MSG">120</span>) word</a></Div>

Effect:

PHP essay 7-thinkphp OA system JS text box input real-time control word count

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.