1
<input type="text" name="theName" value="password"
onblur="if(this.value == ''){ this.value = 'password'; this.style.color = '#333'; this.type="text";}"
onfocus="if(this.value == 'password'){ this.style.color = '#666';}"
onkeypress="if(this.value == 'password'){ this.value = ''; this.style.color = '#000';this.type="password";}"
style="color:#BBB;" />
,의의 DefaultValue는 밝은 색으로 표시됩니다. (페이 스북 검색 바처럼) ... 하지만 이드는 작동하지 않습니다 ... 무엇을 잘못 쓰셨습니까?암호 INT는 - 텍스트 필드가 onfocus 및하지만, 일이 그 위에 기록되어있다가 아닌 경우 NO jQuery를/CSS3/HTML5 이와 같이
내가하지 않는 또 다른 한가지는 그 나는이 자바 스크립트를 타고 난 이런 태그에 넣어 경우 :
<script type="text/javascript">
function passfocus(){
if(this.value == 'password'){this.style.color = '#666';}}
function passblur(){
if(this.value == 'password'){ this.style.color = '#666';}}
function passkey(){
if(this.value == 'password'){
this.value = ''; this.style.color = '#000';this.type="password";}}
</script>
그리고 난 같은 텍스트 필드에서이 스크립트를 호출
을<input type="text" name="theName" value="password" onblur="passblur()"
onfocus="passfocus()" onkeypress="passkey()" style="color:#BBB;" />
아무것도 더 이상 작동하지 않습니다 ... 나는 내가 모든 것을 엉망으로 만든 것 같아요 !!
'내가 알고있는 것에 대한 원인은, 모든 브라우저 또는 운영 체제되지는 HTML5를 지원합니다 –
\ 또 다른 가능성이 힌트를 포함하는 간단한 요소가하는 것입니다. 상자에 텍스트가 있으면 표시하고 숨기면됩니다. 이것은 당신이 다른 곳으로 당신의 힌트를 옮기고 싶다면, 쉽게 스타일 할 수있는 이중 이점을 가지고 있습니다. 상자 또는 다른 곳으로 스팬을 배치 할 수 있습니다. –
더하기, 자리 표시 자 값은 텍스트 필드를 클릭하면 자동으로 삭제되며, HTML5 없이도이를 수행하는 방법을 이미 알고 있습니다. 시작할 때까지 텍스트 필드를 클릭 할 때 기본값을 그대로 두려고했습니다. 타자. –