암호 입력란에 자리 표시자를 사용했습니다. 암호 입력 필드의 입력 유형이 "텍스트"이면 암호를 입력해도 제대로 작동하지 않습니다.암호 입력란에 자리 표시자가 작동하지 않습니다.
암호를 입력하면 암호의 첫 번째 문자가 올바르게 입력되지 않습니다. 키 누르기가 처음 작동하지 않습니다.
은 아래 링크를 그것이 내가 자리의 암호 필드를 사용하고 팝업 창을 열고 로그인 버튼을http://www.techmodi.com/demo/firstjitters/
클릭을 클릭하십시오.
코드 :
<input name="password" id="password" type="text" class="input" tabindex="2" placeholder="Password" />
JS 파일 :
window.onload = function() {
var arrInputs = document.getElementsByTagName("input");
for (var i = 0; i < arrInputs.length; i++) {
var curInput = arrInputs[i];
if (!curInput.type || curInput.type == "" || curInput.type == "text" || curInput.type == "password")
HandlePlaceholder(curInput);
}
};
function HandlePlaceholder(oTextbox) {
//alert(typeof oTextbox.placeholder);
if (typeof oTextbox.placeholder == 'string') {
var curPlaceholder = oTextbox.getAttribute("placeholder");
if (curPlaceholder && curPlaceholder.length > 0) {
oTextbox.value = curPlaceholder;
oTextbox.setAttribute("old_color", oTextbox.style.color);
oTextbox.style.color = "#c0c0c0";
oTextbox.onfocus = function() {
this.style.color = this.getAttribute("old_color");
if (this.value === curPlaceholder)
this.value = "";
};
oTextbox.onblur = function() {
if (this.value === "") {
this.style.color = "#c0c0c0";
this.value = curPlaceholder;
}
};
}
}
}
질문에 코드를 추가 할 수 있습니까? – andrewsi
IE에서 질문에 태그를 추가했는데이 문제는 IE에서만 발생합니까? 그렇다면 어떤 버전입니까? – j08691
아니요 ...이 문제는 mozilla (버전 : 21.0)에서도 발생합니다. IE-8 및 크롬과 동일 – user2417911