<html>
<head></head>
<body>
<div>
<input type="text" value="密碼" onfocus="if(this.value==defaultValue) {this.value='';this.type='password'}" onblur="if(!value) {value=defaultValue; this.type='text';}" style="color:#666;" />
</div>
</body>
</html>html
默認狀態下this
獲取焦點後htm