网站首页 > 技术文章 正文
1.文本框显示默认文字:
<textarea>白鸽男孩</textarea> <textarea>白鸽男孩</textarea>
2.鼠标点击文本框,默认文字消失:
<textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea> <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea>
3.鼠标移至文本框,默认文字消失:
<textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea> <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea>
4.鼠标点击文本框,默认文字消失,点击文本框外任意区域,默认文字又重现:
<textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onblur=”if(value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea> <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onblur=”if(value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea>
5.鼠标移至文本框,默认文字消失,鼠标移出文本框,默认文字又重现:
<textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onmouseout=”blur()” onblur=”if (value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea> <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onmouseout=”blur()” onblur=”if (value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea>
6.鼠标单击文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):
<textarea onclick=”value=’ ‘”>白鸽男孩</textarea> <textarea onclick=”value=’ ‘”>白鸽男孩</textarea>
7.鼠标移至文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):
<textarea onmouseover=”value=’ ‘”>白鸽男孩</textarea> <textarea onmouseover=”value=’ ‘”>白鸽男孩</textarea>
8.单击文本框后全选文本框内的文字:
<textarea onfocus=”select()”>白鸽男孩</textarea> <textarea onfocus=”select()”>白鸽男孩</textarea>
9.鼠标移至文本框全选文本框内的文字:
<textarea onmouseover=”focus()” onfocus=”select()”>白鸽男孩</textarea> <textarea onmouseover=”focus()” onfocus=”select()”>白鸽男孩</textarea>
10.回车后焦点从当前文本框转移到下一个文本框:
<textarea onkeydown=”if(event.keyCode==13)event.keyCode=9″>白鸽男孩</textarea> <textarea onkeydown=”if(event.keyCode==13)event.keyCode=9″>白鸽男孩</textarea>
11.回车后焦点从当前文本框转移到指定位置:
<textarea onkeypress=”return focusNext(this,’指定位置的id名称’,event)”>白鸽男孩</textarea>
12.鼠标点击input文本框,默认文字消失:
<input type="text" style="color:#bbbbbb" value="搜索活动名称、地址或活动ID" size="60" onfocus="if (value =='搜索活动名称、地址或活动ID'){value='';}" onblur="if (value ==''){value='搜索活动名称、地址或活动ID';}" />
13.单击input文本框后全选文本框内的文字:<input type="text" style="color:#bbbbbb" value="搜索活动名称、地址或活动ID" size="60" onfocus="this.select();"/>
猜你喜欢
- 2025-03-30 学会IDEA REST Client后,postman就可以丢掉了...
- 2025-03-30 学习在Postman中发送POST请求的最佳实践
- 2025-03-30 IDEA中居然藏着一个跟Postman一样好用的插件
- 2025-03-30 《5分钟Java》实现excel文件上传并解析
- 2025-03-30 不会接口测试?用Postman轻松入门(八下)——请求结果断言方法
- 2025-03-30 「Postman」测试(Tests)脚本编写和断言详解
- 2025-03-30 Spring Boot对接twilio发送邮件信息
- 2025-03-30 Crowd 批量添加用户(Postman 数据驱动)
- 2025-03-30 RPA028-调用飞书API发送文件(.netのc#)
- 2025-03-30 使用Postman快速上手ONES OpenAPI
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)