Safari/Chrome中placeholder属性实现不完整


placeholder属性是HTML5中提出的,目前Firefox/Safari/Chrome/Opera都已经实现了。IE9仍然没实现。

但Safari/Chrome中有个问题,点击文本框内文字不消失。

 

如下

<!DOCTYPE html>
<html>
	<head>
		<title>Safari/Chrome中placeholder属性实现不完整</title>
		<meta charset="utf-8">
	</head>
	<body>
		<p>
			<input type="text" placeholder="username"/>
		</p>
	</body>
</html>

 

运行后将鼠标点入input输入框内,各浏览器表现如下。

 

Firefox/Opera中文字消失

Safari/Chrome中文字不消失

IE6/7/8/9不支持该属性,即不出现文字提示

 

 

相关:

http://www.w3.org/TR/html5/common-input-element-attributes.html#attr-input-placeholder

https://developer.mozilla.org/en/HTML/Element/input#attr-placeholder

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM