js+CSS 实现选项卡

1 篇文章 0 订阅
1 篇文章 0 订阅

遇到万恶的手动实现选项卡= =!

js控制调用样式

<script type="text/javascript">
			function display(obj){
			
				if(obj=="1"){
					//document.getElementById("XX_id").style.display="none";//隐藏
					//document.getElementById("XXX_id").style.display="";//显示
					document.getElementById("divid1").className="trapezoid1";
					document.getElementById("spanid1").className="tx1";
					document.getElementById("divid2").className="trapezoid";
					document.getElementById("spanid2").className="tx";
				}
				
				if(obj=="2"){
					document.getElementById("XXX_id").style.display="none";//隐藏
					document.getElementById("XX_id").style.display="";//显示
					document.getElementById("divid1").className="trapezoid";
					document.getElementById("spanid1").className="tx";
					document.getElementById("divid2").className="trapezoid1";
					document.getElementById("spanid2").className="tx1";
				}
			}
		</script>

下面是CSS代码:

<style type="text/css">
		.trapezoid { 
			border-bottom: 30px solid #669; 
			border-right: 20px solid transparent;
			width:100px;
			hight:20px;
			display:inline;
			margin-top:-20px;
			z-index:1;
			}
		.trapezoid1 { 
			border-bottom: 30px solid white; 
			border-right: 20px solid transparent;
			width:100px;
			hight:20px;
			display:inline;
			margin-top:-23px;
			z-index:1;
			}
		.tx {
			border-left:90px;
			position:relative;
			width:100px;
			left:-190px;
			display:inline;
			z-index:2;
			cursor:hand;
		  }		
		.tx1 {
			border-left:90px;
			position:relative;
			width:100px;
			left:-190px;
			color:black;
			display:inline;
			z-index:2;
			cursor:hand;
		  }	
		</style>

上面用div实现的画不规则图形,这是

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值