admin管理员组文章数量:1287630
I know that we can use these line of codes as below to pass a password to main window in html:
var password ;
password = prompt('<fmt:message key="ipack.delete.password"/>','');
if (password){
document.location = link+ "&pw="+password;
}
But, the problem is that if I use "prompt", the input field to type password will not be rendered such as password input. I want to hide the characters in password like **. Could you please help me to solve it?
Thanks a lot,
I know that we can use these line of codes as below to pass a password to main window in html:
var password ;
password = prompt('<fmt:message key="ipack.delete.password"/>','');
if (password){
document.location = link+ "&pw="+password;
}
But, the problem is that if I use "prompt", the input field to type password will not be rendered such as password input. I want to hide the characters in password like **. Could you please help me to solve it?
Thanks a lot,
Share Improve this question asked Jul 5, 2013 at 2:35 hoang nguyenhoang nguyen 2,2195 gold badges22 silver badges20 bronze badges1 Answer
Reset to default 7Here is a Demo of how you could proceed for a custom popup & get the password:
HTML:
<div id="popup">
<div>Enter Password:</div>
<input id="pass" type="password"/>
<button onclick="done()">Done</button>
</div>
<button onclick="showPopup()">Show Popup</button>
STYLE:
#popup {
width:160px;
height:80px;
padding:20px;
background-color:gray;
position:absolute;
top:100px;
left:100px;
display:none;
}
SCRIPT:
function done() {
document.getElementById("popup").style.display = "none";
var password = document.getElementById("pass").value;
//DO STUFF WITH PASSWORD HERE
};
function showPopup() {
document.getElementById("popup").style.display = "block";
}
本文标签: javascriptHow to write a popup window to pass the password to main windowStack Overflow
版权声明:本文标题:javascript - How to write a popup window to pass the password to main window? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741250461a2365691.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论