国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

瀏覽器打開層自動緩慢展開收縮實例代碼

2024-05-06 15:48:42
字體:
來源:轉載
供稿:網友
本文為大家介紹下層自動緩慢展開收縮在瀏覽器打開時是如何實現的,主要用到了slideUp及slideDown等主要jquery方法,感興趣的朋友可以參考下哈,希望對大家有所幫助

例子:

復制代碼 代碼如下:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style>
#screefull{display:block; border:1px solid #bddbf3; width:954px; padding:3px 5px 7px; margin:0 auto 10px; background:#fef9db; }
#mostrar{display:block; width:954px; display:none;}
#screefull a.close{ display:block; width:25px; height:20px; background:url(img/cx.gif) no-repeat 0 0; overflow:hidden; float:right; margin:16px 8px 0 0; *margin-right:5px; text-decoration:none;}
#screefull p{ display:block; text-align:center; font-family:"Microsoft Yahei"; font-size:14px; color:#000; height:28px; line-height:28px; vertical-align:middle;}
#screefull var{ display:inline-block; *display:inline; *zoom:1; background:url(img/wicon.gif) no-repeat 0 0; width:28px; height:28px; overflow:hidden; vertical-align:middle; margin-right:10px;}
#screefull em{ display:inline-block; *display:inline; *zoom:1; color:#ff0000; font-family:"Microsoft Yahei"; font-style:normal;}
#screefull span{ display:inline-block; *display:inline; *zoom:1; vertical-align:middle;}
#screefull p a{ display:inline-block; *display:inline; *zoom:1; color:#2400ff; text-decoration:underline;}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<!--begin:1-->
<div>
<div>
<a href="#">[x]</a>
<p><span>在<em>未通過審核的網站</em>添加廣告代碼,將不會產生傭金。<a href="#" target="_blank" >我知道了</a></span></p>
</div>
</div>
<script type="text/javascript">
function closewarn(type)
{
$("#warn").slideUp("slow");
if(type == 'know')
{
$.post(window.location.href,{op : 'setwarn'},function(data)
{
return true;
});
}
}
window.onload = function()
{
$("#warn").slideDown(2000);
}
</script>
<!--end:1-->
</body>
</html>


解釋上面代碼段:
1、$("#warn").slideUp("slow");向上滑動, $("#warn").slideDown(2000);向下滑動
2、$.post(window.location.href,{op : 'setwarn'},function(data)
{
return true;
})
運用到了ajax 提交 跟服務器進行交互,
第一個參數是請求的地址 第二個是提交的參數 第三個是請求成功 之后調用的方法
參數op 的值是setwarn json串的格式具體運用解說看
url 對應 locaotion.href(取得是當前頁面的地址)
data對應 {op:setwarn} 字符串
success 對應 函數

3、window.onload = function(){}作用一般在<text/javascript>中寫的函數都要在body頁面中調用,用此函數就不用等著body頁面中調用就可以執行了
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 邳州市| 邢台县| 绩溪县| 荆门市| 响水县| 固原市| 灵台县| 闵行区| 许昌市| 秭归县| 乌恰县| 常州市| 汉阴县| 九台市| 葵青区| 县级市| 肇源县| 家居| 满洲里市| 赤峰市| 广宁县| 紫金县| 镇原县| 泾川县| 福贡县| 基隆市| 九龙城区| 西峡县| 青神县| 赤水市| 东莞市| 玉门市| 永济市| 封开县| 遂昌县| 嘉峪关市| 余姚市| 温宿县| 游戏| 米林县| 焉耆|