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