惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
C
Cisco Blogs
The Hacker News
The Hacker News
T
Threatpost
S
Schneier on Security
K
Kaspersky official blog
Spread Privacy
Spread Privacy
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
NISL@THU
NISL@THU
量子位
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google DeepMind News
Google DeepMind News
Security Latest
Security Latest
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
博客园 - 叶小钗
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
爱范儿
爱范儿
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Vulnerabilities – Threatpost
Forbes - Security
Forbes - Security
博客园 - 三生石上(FineUI控件)
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News and Events Feed by Topic
V
V2EX
Webroot Blog
Webroot Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
Scott Helme
Scott Helme
Simon Willison's Weblog
Simon Willison's Weblog
L
LangChain Blog
W
WeLiveSecurity
Cloudbric
Cloudbric

博客园 - 嚣张的沉默

读写txt文档 限制TextBox输入字数 我常用的正则与SQL语句 DataSet导入到Excel 年月日联动的JS代码 用户控件的传值方法 Repeater模板列 asp.net的几个小技巧 百叶窗效果 建站安全 倒计时代码 解决SQL2000安装服务器挂起 删除.NET的最近项目 屏幕右下角弹出广告 DataSet写入、导出XML 上传图片重命名并创建文件夹 自动跳转页面带参数 微软出的AJAX控件的安装(转载) 第一次开博
计算TextBox输入的字数
嚣张的沉默 · 2008-03-05 · via 博客园 - 嚣张的沉默

<script language="javascript" type="text/javascript" >
    
// change()方法 在id 为txt 的TextBox 触发 onkeyup 事件时执行
        function change()
        
{
            
//找到txt 并获得他的内容
            var value=document.getElementById('txt').value;
            
//计算还可以输入多少字符
            var sum=20-value.length;
            
//判断能输入的字符数是否为负
            if(sum<0)
            
{
                
//找到显示控件 并显示相应提示
                document.getElementById('showDiv').innerHTML= '您还可以输入'+sum+'字符';
                
//为负设置颜色为红色
                document.getElementById('showDiv').style.color='red';
            }

            
else
                document.getElementById(
'showDiv').innerHTML= '您还可以输入'+sum+'字符';
        }

        
</script>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
    
<asp:TextBox ID='txt' runat="server" onkeyup="change()"  ></asp:TextBox>
        
<div id='showDiv'>您还可以输入20字符</div>
        

    
</div>

posted on 2008-03-05 16:07  嚣张的沉默  阅读(440)  评论(0)    收藏  举报

刷新页面返回顶部