码迷,mamicode.com
首页 > 其他好文 > 详细

焦点事件2016、4、21

时间:2016-04-21 21:55:33      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题pj文档</title>
<script>
window.onload = function() {
	
	 var obtn=document.getElementById(‘btn‘);
	var otext=document.getElementById(‘text1‘);
	otext.onfocus=function()
	{
		if(this.value==‘please‘)
		{
			this.value=‘‘;
		}
	}
	otext.onblur=function()
	{
		if(this.value==‘‘)
		{
			this.value=‘please‘;
		}
	}
	obtn.onclick=function()
	{
		otext.select();
	}
	//obj.focus()
	//obj.blur();
//obj.select()
	
}
</script>
</head>

<body>
	<input type="text" id="text1" value="please" />
    <input type="button" value="全选" id="btn" />
</body>
</html>

  

焦点事件2016、4、21

标签:

原文地址:http://www.cnblogs.com/hduhdc/p/5418712.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!