62,046
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
<!--
function abc()
{
document.getElementById('div123').style.display='none';
}
-->
</script>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["flag"] == null) //如果尚未登录,Session["flag"]=true,表明已建立登录状态
{
Page.RegisterStartupScript("a", "<script type='text/javascript'>abc();</script>"); //展示提示DIV
}
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
<style type="text/css">
*{margin:0px auto}
body{margin:0px auto 0px auto;text-align:center;padding:0px;}
</style>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#div123").slideDown("slow",function(){
setTimeout(function(){
$("#div123").slideUp("slow");
},2000);
})
})
</script>
</head>
<body>
<div id="div123" style="width:980px;height:50px;background:red;display:none;">a<br />b<br />c<br /></div>
<div style="width:980px;height:1000px;background:black;color:#fff">def</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
<style type="text/css">
*{margin:0px auto}
body{margin:0px auto 0px auto;text-align:center;padding:0px;}
</style>
</head>
<body>
<div id="div123" style="width:980px;height:50px;background:red;display:block;margin-top:-50px;">a<br />b<br />c<br /></div>
<div style="width:980px;height:1000px;background:black;color:#fff">def</div>
<script type="text/javascript">
var obj = document.getElementById("div123");
var height=-50,current;
var Timer;
obj.style.display="block";
Timer=setInterval(SlideDown,10);
function SlideDown(){
current = GetHeight(obj);
if(current>=0){
clearInterval(Timer);
setTimeout(function(){
Timer = setInterval(SlideUp,10);
},2000);
}
else{
current++;
SetHeight(current);
}
}
function SlideUp(){
if(current<=height){
clearInterval(Timer);
}
else{
current--;
SetHeight(current);
}
}
function GetHeight(){
return parseInt(obj.style.marginTop);
}
function SetHeight(h){
obj.style.marginTop=h+"px";
}
</script>
</body>
</html>