• AJAX实现页面选项卡、隔行换色、弹出层功能代码


    代码简介:AJAX实现页面选项卡、隔行换色、弹出层功能代码

    代码内容:

    <!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实现页面选项卡、隔行换色、弹出层功能代码_网页代码站(www.webdm.cn)</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-1px 1px 0 0; margin-left:20px;}
    td,th { padding:5px;border:1px solid #ccc;border-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.webdm.cn
    	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;300px;height:260px;border:1px solid #ccc;margin:0 20px;}
    .tabs ul {200px;height:21px;overflow:hidden;position:absolute;top:0;left:0;}
    .tabs ul li {float:left;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;100%;font-size:14px;text-decoration:none;}
    .tabs ul li a:visited { color:#4a4a4a;}
    
    .tabs .tablist {height:260px;overflow:hidden;}
    .tabs .s {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;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;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>
    <br>
    <p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的代码下载网站 - 致力为中国站长提供有质量的代码
    
    !</p>
    

    代码来自:http://www.webdm.cn/webcode/126e2978-8a53-4c81-a0a4-e095b381da6b.html

  • 相关阅读:
    rsync 安全复制使用程序
    mysql 的sleep线程过多处理方法
    test
    跨域问题的解决
    在VMWare里安装Win11虚机
    Nginx 基础入门(收藏)
    NMXweb版
    ORA12519: TNS:no appropriate service handler found 解决
    关于工作中的第一个项目的个人总结[主要是个人学到的东西,细节]
    处理警告:No configuration found for the specified action
  • 原文地址:https://www.cnblogs.com/webdm/p/2031688.html
Copyright © 2020-2023  润新知