一段非常不错的控制文本框输入文字长度的JS代码

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:mudoo>
    
<head>
        
<title>statInput 输入限制统计title>
        
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        
<style type="text/css"> style>
        
<script language="javascript" type="text/javascript">  
  
        
script>
        
<script language="javascript" type="text/javascript">  
  
        
script>
        
<script language="javascript" type="text/javascript">  
  
        
script>
    
head>
    
<body>
        
<div class="case" id="DIV1">
            
<div class="title"><href="#" class="r">Topa>statInput 调用方法div>
            
<div class="b">statInput(Element, MaxLen, {objMax, objTotal, objLeft, Hint});div>
            
<ul class="info gray">
                
<li>
                    
<span class="key">Element:span><span class="type">Objectspan>限制统计对象 (*必须)li>
                
<li>
                    
<span class="key">MaxLen:span><span class="type">Numberspan>最大可输入长度 (*必须)li>
                
<li>
                    
<span class="key">objMax:span><span class="type">Objectspan>显示最大输入长度对象 
                    (*可选)
li>
                
<li>
                    
<span class="key">objTotal:span><span class="type">Objectspan>显示输入统计对象 
                    (*可选)
li>
                
<li>
                    
<span class="key">objLeft:span><span class="type">Objectspan>显示可输入长度对象 
                    (*可选)
li>
                
<li>
                    
<span class="key">Hint:span><span class="type">Booleanspan>当长度超出上限时,是否提示 
                    (*可选)
li>
            
ul>
        
div>
        
<div class="case" id="DIV2">
            
<div class="title"><href="#" class="r">Topa>statInput 演示div>
            
<textarea name="Test_1" id="Test_1" rows="10" style="WIDTH: 99%">悟空你也太调皮了,我跟你说过,叫你不要乱扔东西, 乱扔东西这么做…… (咣当,悟空棍子掉在地上) 你看我还没有说完呢你把棍子又给扔掉了!月光宝盒是宝物,你把他扔掉会污染环境,唉,要是砸到小朋友那怎么办?就算没有砸到小朋友砸到那些花花草草也是不对的呀!textarea>
            
<div class="gray">最多可输入<span id="stat_max" class="b light">span>,当前共<span id="stat_total" class="b light">span>,还可输入<span id="stat_left" class="b light">span>div>
        
div>
    
body>
html>

 

转自:http://www.cnblogs.com/nacarat/archive/2008/12/22/1325656.html

 

 

你可能感兴趣的:(ASP.NET,2.0,ASP.NET,JavaScript)