如何点击一个文本框后全选中? 我想在网页上做一个输入邮箱的文本框,希望用户点击后自动全选,请问这个功能如何实现的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主会jquery 么?不会的话,学学这个,以后碰到这些小的应用就省事了。 使用jquey解决://report_all 为所有的checkbox的classfunction check_all_report(){ $(".report_all").each( function() { if($(this).attr('checked')) { $(this).removeAttr('checked'); }else { $(this).attr('checked','checked'); } } );} 你登陆qq和msn输入账号名的时候就明白我的意思了 参考。http://www.jb51.net/article/15623.htm有时间可以在网上找答案,速度更快 //jquery 解决方法 $(":text,:password").focus(function() { $(this).select(); }); <html><head><script type="text/javascript" src="/jquery.js"></script><script type="text/javascript">$(document).ready(function(){ $("#txt1").focus(function(){ this.select();});});</script></head><body>Enter your name: <input type="text" id="txt1" /></body></html> <input type="text" onfocus="this.select()" /> 帮忙看看这个PHP程序 制作动态图表用什么技术? PHP变量的非空判断 推荐个好的php+mysql空间,收费的! 请问一下php的正则问题 win32服务问题 使用PHP怎样将保存在Mysql的long blob类型字段中的文件下载下来? 存储过程传递数组变量--跪求中 我怎么知道鼠标是点的那一个超级链接? php是否支持access,paradox数据库 PHP怎样切?来看看哦! 如何在a.php获取指定id然后修改b.php中的相关数据?
//report_all 为所有的checkbox的class
function check_all_report(){
$(".report_all").each( function() {
if($(this).attr('checked')) {
$(this).removeAttr('checked');
}else {
$(this).attr('checked','checked');
}
} );
}
http://www.jb51.net/article/15623.htm有时间可以在网上找答案,速度更快
//jquery 解决方法 $(":text,:password").focus(function() {
$(this).select();
});
<head>
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txt1").focus(function(){
this.select();
});
});
</script>
</head>
<body>
Enter your name: <input type="text" id="txt1" />
</body>
</html>