input框提示文字颜色(input文本框提示信息)
输入框内输入文字后,光标和文字之间,留有一点空隙,使用js方法,给框内的最后文字加个空格;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD><script>function a() {var a = window.document.getElementById("aa").value;window.document.getElementById("aa").value = a.replace(" ", "") + " ";var e = event.srcElement; var r = e.createTextRange();if(a.length == 1){r.moveStart('character',1); //定位光标位置r.collapse(true); r.select();}else{r.moveStart('character',a.length - 1); //定位光标位置r.collapse(true); r.select();}}</script> </HEAD> <BODY><input id=aa onkeyup="a()" /> </BODY></HTML>
原创文章,作者:admin,如若转载,请注明出处:https://www.qq65hfghe5.com/tg/47503.html