页面输入框自动提示功能怎么设置它显示或者不显示啊.... 我现在显示的位置跟输入框的位置相差很远,或者有什么解决办法,求解....

解决方案 »

  1.   

    Form Validation 
      

  2.   

    没有用到什么js框架   就是服务器控件 TextBox
      

  3.   

    你用jquery的 autocomplete 有熟悉
      

  4.   

    整个系统都没用jquery 请大家不要往jquery那方面想
      

  5.   

    js验证<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Validation Hints</title><style type="text/css">
    body { margin:20px auto; width:700px;font-size:12px;color:#333;}
    a {FONT-SIZE: 12px;  font-family: "微软雅黑"; font-weight:800; color:#FF3300;}form {
    width:500px;
    border:1px solid #ccc;
    }
    fieldset {
    border:0;
    padding:10px;
    margin:10px;
    position:relative;
    }
    label {
    display:block;
    font:normal 12px/17px verdana;
    }
    input {width:160px;}
    span.hint {
    font:normal 11px/14px verdana;
    background:#eee url(bg-span-hint-gray.gif) no-repeat top left;
    color:#444;
    border:1px solid #888;
    padding:5px 5px 5px 40px;
    width:250px;
    position:absolute;
    margin: -12px 0 0 14px;
    display:none;
    }
    fieldset.welldone span.hint {
    background:#9fd680 url(bg-span-hint-welldone.jpg) no-repeat top left;
    border-color:#749e5c;
    color:#000;
    }
    fieldset.kindagood span.hint {
    background:#ffffcc url(bg-span-hint-kindagood.jpg) no-repeat top left;
    border-color:#cc9933;
    }
    fieldset.welldone {
    background:transparent url(bg-fieldset-welldone.gif) no-repeat 194px 19px;
    }
    fieldset.kindagood {
    background:transparent url(bg-fieldset-kindagood.gif) no-repeat 194px 19px;
    }
    </style><script type="text/javascript">// This function checks if the username field
    // is at least 6 characters long.
    // If so, it attaches class="welldone" to the 
    // containing fieldset.function checkUsernameForLength(whatYouTyped) {
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (txt.length > 2) {
    fieldset.className = "welldone";
    }
    else {
    fieldset.className = "";
    }
    }// If the password is at least 4 characters long, the containing 
    // fieldset is assigned class="kindagood".
    // If it's at least 8 characters long, the containing
    // fieldset is assigned class="welldone", to give the user
    // the indication that they've selected a harder-to-crack
    // password.function checkPassword(whatYouTyped) {
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (txt.length > 3 && txt.length < 8) {
    fieldset.className = "kindagood";
    } else if (txt.length > 7) {
    fieldset.className = "welldone";
    } else {
    fieldset.className = "";
    }
    }// This function checks the email address to be sure
    // it follows a certain pattern:
    // [email protected]
    // If so, it assigns class="welldone" to the containing
    // fieldset.function checkEmail(whatYouTyped) {
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt)) {
    fieldset.className = "welldone";
    } else {
    fieldset.className = "";
    }
    }
    // this part is for the form field hints to display
    // only on the condition that the text input has focus.
    // otherwise, it stays hidden.function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          oldonload();
          func();
        }
      }
    }
    function prepareInputsForHints() {
      var inputs = document.getElementsByTagName("input");
      for (var i=0; i<inputs.length; i++){
        inputs[i].onfocus = function () {
          this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
        }
        inputs[i].onblur = function () {
          this.parentNode.getElementsByTagName("span")[0].style.display = "none";
        }
      }
    }
    addLoadEvent(prepareInputsForHints);</script>
    </head>
    <body><form
    action="#"
    name="basicform"
    id="basicform" ><fieldset>
    <label for="username">用 户 名:</label>
    <input
    type="text"
    id="username"
    onkeyup="checkUsernameForLength(this);" />
    <span class="hint">昵称长度需大于3个字符,请使用英文字母、符号或数字.</span>
    </fieldset><fieldset>
    <label for="password">密 码:</label>
    <input
    type="password"
    id="password"
    onkeyup="checkPassword(this);" />
    <span class="hint">密码长度需大于4个字符,可使用任意字符,建议使用8个字符.</span>
    </fieldset><fieldset>
    <label for="email">电子邮件:</label>
    <input
    type="text"
    id="email"
    onkeyup="checkEmail(this);" />
    <span class="hint">用来确认您的会员身份,维奇网绝不会公开此信息!</span>
    </fieldset></form>
    <center><br />
    </center>
    </body>
    </html>
      

  6.   

    http://www.cnblogs.com/wangbin_ben/archive/2010/08/06/1793765.html
    http://blog.csdn.net/zhuzhao/article/details/3686061
    参考下
      

  7.   

    textBox的AutoCompleteType属性设置成Disabled