日期:2014-05-16 浏览次数:20458 次
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(); } } ); } }
------解决方案--------------------
<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>
这样试试