弹出层

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax选项卡、隔行换色、弹出层</title>
<style type="text/css">
* {margin:0;padding:0;list-style:none;font-size:12px;line-height:20px;font-family:Arial;}
h1,h2,h3 { font-size:14px; margin:10px 0;}
hr { margin:10px 0; height:1px;clear:both;border:0; background:#c00;}
a:link,a:visited{color:#164A84;text-decoration:none;}
a:hover,a:active{color:#c00;text-decoration:underline;}
table { border-collapse:collapse;border:1px solid #ccc;border-width:1px 1px 0 0; margin-left:20px;}
td,th { padding:5px;border:1px solid #ccc;border-width:0 0 1px 1px;}
</style>
<script type="text/javascript">
function BtHide(id){var Div = document.getElementById(id);if(Div){Div.style.display="none"}}
function BtShow(id){var Div = document.getElementById(id);if(Div){Div.style.display="block"}}

function BtTabRemove(index,head,divs) {
 var tab_heads = document.getElementById(head);
 if (tab_heads) {
 var lis = tab_heads.getElementsByTagName("li"); var as = tab_heads.getElementsByTagName("a");
 for(var i=0;i<as.length;i++){lis[i].className = "";BtHide(divs+"_"+i);if (i==index) {lis[i].className = "current";}}
 BtShow(divs+"_"+index)}
}

function BtTabOn(head,divs){
 var tab_heads=document.getElementById(head);
 if (tab_heads) {
 BtTabRemove(0,head,divs);
 var alis=tab_heads.getElementsByTagName("a");
 for(var i=0;i<alis.length;i++) {
 alis[i].num=i;
 alis[i].onclick = function(){BtTabRemove(this.num,head,divs);this.blur();return false;}
 alis[i].onfocus = function(){BtTabRemove(this.num,head,divs)}}}
}

function BtZebraStrips(id,tag) {
 var ListId = document.getElementById(id);
 if(ListId){
 var tags  = ListId.getElementsByTagName(tag);
 for(var i=0;i<tags.length;i++) {
 tags[i].className   += " barry"+i%2;
 tags[i].onmouseover = function(){this.className += " hover"}
 tags[i].onmouseout  = function(){this.className = this.className.replace(" hover","")}}}
}

function BtPopload(showId){// http://www.codefans.net
 var h = Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight) + 'px';
 var w = document.documentElement.scrollWidth + 'px';
 var popCss = "background:#000;opacity:0.3;filter:alpha(opacity=30);position:absolute;left:0;top:0;overflow:hidden;"
 var exsit = document.getElementById("popBox");
 if (!exsit) {
  pop_Box = document.createElement("div");pop_Box.id = "popBox";
  document.getElementsByTagName("body")[0].appendChild(pop_Box);
  pop_Box.style.cssText = popCss;pop_Box.style.zIndex = "10";
  pop_Box.style.height = h;pop_Box.style.width = w;
  
  pop_Iframe = document.createElement("iframe");pop_Iframe.id = "popIframe";
  document.getElementsByTagName("body")[0].appendChild(pop_Iframe); 
  pop_Iframe.style.cssText = popCss;pop_Iframe.style.zIndex = "9";
  pop_Iframe.style.height = h;pop_Iframe.style.width = (parseInt(w)-5)+"px";
 }
 BtShow("popIframe");BtShow("popBox");BtShow(showId);
 pop_Win = document.getElementById(showId);
 pop_Win.style.position = "absolute";
 pop_Win.style.zIndex = "11";
 pop_Win.style.top = document.documentElement.scrollTop+document.documentElement.clientHeight/2-pop_Win.offsetHeight/2+ 'px';
 pop_Win.style.left = (document.documentElement.clientWidth/2-pop_Win.offsetWidth/2) + 'px';
}
function BtPopShow(Bid,Did) {
 var UploadBtn = document.getElementById(Bid);
 if (UploadBtn){UploadBtn.onclick = function() {BtPopload(Did);return false;}} 
}
function BtPopHide(Bid,Did) {
 var UploadBtn = document.getElementById(Bid);
 if (UploadBtn){UploadBtn.onclick = function() {BtHide(Did);BtHide("popBox");BtHide("popIframe");return false;}} 
}
</script>
</head>

<body style="padding:0 40px;">
<style type="text/css">
.tabs {position:relative;width:300px;height:260px;border:1px solid #ccc;margin:0 20px;}
.tabs ul {width:200px;height:21px;overflow:hidden;position:absolute;top:0;left:0;}
.tabs ul li {float:left;width:60px;border-right:1px solid #ccc;border-bottom:1px solid #ccc;text-align:center;background:#f5f5f5;}
.tabs ul li.current { border-bottom:0; background:#fff;}
.tabs ul li a {color:#4a4a4a;display:block;width:100%;font-size:14px;text-decoration:none;}
.tabs ul li a:visited { color:#4a4a4a;}

.tabs .tablist {height:260px;overflow:hidden;}
.tabs .s {width:300px;height:460px;overflow:hidden;text-align:center;font-size:40px;color:#4a4a4a;line-height:160px; background:#fff;}
.tabs a.more { background:#fff;color:#4a4a4a;line-height:20px;float:right;padding:0 5px; font-family:Verdana;}
</style>
<h2>1:tab</h2>
<div class="tabs">
 <ul id="head">
  <li><a href="#s_0">PHP</a></li>
  <li><a href="#s_1">Ajax</a></li>
  <li><a href="#s_2">ASP</a></li>
 </ul>
 <div class="tablist">
  <div class="s" id="s_0">
   <a href="#" class="more">More PHP</a>
   s1 content
  </div>
  <div class="s" id="s_1">
   <a href="#" class="more">More Ajax</a>
   s2 content
  </div>
  <div class="s" id="s_2">
   <a href="#" class="more">More ASP</a>
   s3 content
  </div> 
 </div>
</div>
<script type="text/javascript">BtTabOn("head","s")</script>
<hr />

 

<style type="text/css">
.barry1 {background:#f5f5f5;}
.barry0 {background:#fff;}
.hover {background:#ddd;}
</style>
<h2>2:隔行换色</h2>
<div class="hot_car" id="hot_car">
<table cellpadding="0" cellspacing="0">
 <thead><tr><td>厂商指导价</td><td>经销商报价</td><td>促销信息</td><td>报价时间</td></tr></thead>
 <tr><td>12.02万</td><td>19.18万</td> <td>五子棋游戏进阶版源码</td><td>2009-02-15</td></tr>
 <tr><td>12.02万</td><td>19.18万</td> <td>五子棋游戏进阶版源码</td><td>2009-02-15</td></tr>
 <tr><td>12.02万</td><td>19.18万</td> <td>五子棋游戏进阶版源码</td><td>2009-02-15</td></tr>
</table>
</div>

<style type="text/css">
.ul { margin:20px 0 0 20px;width:300px;border:1px solid #ccc;border-bottom:0;}
.ul li { height:20px; padding:3px 5px;border-bottom:1px solid #ccc;}
</style>
<ul id="ul" class="ul">
 <li><span>[<a href="news.html">企业</a>]</span>  <a href="detail.html">VB监测键盘按下状态</a></li>
 <li><span>[<a href="news.html">企业</a>]</span>  <a href="detail.html">图片旋转显示插件</a></li>
 <li><span>[<a href="news.html">企业</a>]</span>  <a href="detail.html">播放器的窗体界面</a></li>
</ul>
<script type="text/javascript">BtZebraStrips("hot_car","tr");BtZebraStrips("ul","li")</script><hr />
<style type="text/css">
.pop { border:3px solid skyblue;width:400px; background:#fff; padding:5px; display:none;}
</style>
<h2>3:遮罩层</h2>
<a href="#" id="open" style="margin-left:20px">点击弹出</a>
<div class="pop" id="pop"><a href="#" id="close">点击关闭</a></div>
<script type="text/javascript">BtPopShow("open","pop");BtPopHide("close","pop")</script>
<hr />
</body>
</html>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值