http://t.ifeng.com/这是凤凰网的微博。 在主页登陆随便输入个名字密码。在浏览器上方会弹出一个密码错误的提示。请问这种效果是怎么做出来的。求大大们指导。

解决方案 »

  1.   

    ajax做的http://www.w3schools.com/ajax/default.asp
      

  2.   


    function floatDoLogin() {
    var sUsername = $.trim($('#floatLoginName').val());
    var sPwd = $('#floatLoginPwd').val(); if(sUsername == '') {
    floatLoginTishi('请输入用户名');
    return false;
    }else if(sPwd == ''){
    floatLoginTishi('请输入密码');
    return false;
    }else {
    $.getJSON(
    __GLOBAL_VARS.SYS_PATH_WEB + '/?_c=account&_a=doLogin&callback=?',
    {
    loginusername: sUsername,
    password: sPwd,
    remember: '1',
    handler:'jsonHandler'
    },
    function(json){
    if(json.code < 0 ) {
    floatLoginTishi(json.data);
    }else {
    floatLoginTishi('登录成功');
    window.location.reload();
    }
    }
    );
    }
    }
      

  3.   

    <head>
    <script type="text/javascript">
    var t="";
    var s=false;
    function change(){
    var ti="";
    var div=document.getElementById("test");
    var c=0;
    if(parseInt(div.style.height)<=0){
    t=true;
    }else if(parseInt(div.style.height)>=20){
    t=false;
    s=true;
    }
    if(t){
    c=1;
    }else{
    c=-1;
    }
    div.style.height=parseInt(div.style.height)+c+"px";
    ti=window.setTimeout(change,100);
    if(s&&t){
    s=false;
    window.clearTimeout(ti);
    }
    }
    </script>
    </head><body>
    <div id="test" style="position:absolute;left:0px;height:0px;width:1000px;top:0px;overflow:hidden" align="center">error</div>
    <input type="button" onClick="change()" value="change">
    </body>
    这样试试
      

  4.   

    ajax和jquery结合着一起使用的吧...
      

  5.   


    你的这个方法基本是可行的,你的代码一上来也是显示的。我想要一上来隐藏的 已经改好了。但是我想要重复利用。也就是要把提示的内容进行修改。想用传参的方法。  var t = "";
    var s = false;
    function change(neirong) {
    var ti = "";
    var div = document.getElementById("test");
    div.style.display="block";
    div.innerHTML=neirong;
    var c = 0;
    if (parseInt(div.style.height) <= 0) {
    t = true;
    } else if (parseInt(div.style.height) >= 20) {
    t = false;
    s = true;
    }
    if (t) {
    c = 1;
    } else {
    c = -1;
    }
    div.style.height = parseInt(div.style.height) + c + "px";
    ti = window.setTimeout(change, 100);
    if (s && t) {
    s = false;
    window.clearTimeout(ti);
    }
    }<div id="test"
    style="position:absolute;left:0px;height:0px;width:1000px;top:0px;overflow:hidden;display:none;"
    align="center"></div>
    <input type="button" onClick="change('xxxx')" value="change">为什么我这个xxxx没有传过去求解。。是我把原来的东西往光了? - -