js实现仿Windows风格选项卡和按钮效果实例

 更新时间:2015年05月13日 09:41:22   作者:休闲生活文化  
这篇文章主要介绍了js实现仿Windows风格选项卡和按钮效果的方法,可实现类似windows选项卡风格的tab标签效果,需要的朋友可以参考下

本文实例讲述了js实现仿Windows风格选项卡和按钮效果的方法。分享给大家供大家参考。具体实现方法如下:

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<style type="text/css">
<!--
body{
 font-family: 'MS Shell Dlg', 宋体, Tahoma;
 font-size: 12px;
 background-color: #336699;
 color:#000000;
}
td, div, input, textarea{
 font-family: 'MS Shell Dlg', 宋体, Tahoma;
 font-size: 12px;
 cursor: default;
}
.title{
 background-color: #000080;
 color:#fdf7d3;
 padding: 1;
 font-family:宋体;
 font-size:12px;
}
.up{
 background-color: #cccccc;
 color:#000000;
 border: 2px outset #ffffff
}
.down{
 background-color: #cccccc;
 border:2px inset #ffffff
}
.up1{
 background-color: #cccccc;
 color: #000000;
 border: 1px outset #ffffff
}
.down1{
 background-color:#cccccc;
 border:1px inset #ffffff
}
.l {
 background-color: #cccccc;
 height: 18px;
 border-left: 2px outset #ffffff; 
 border-right: 2px outset #ffffff;
 color:#000000;
 border-top: 2px outset #ffffff;
 padding-top: 2;
 height:18
}
.lc {
 background-color: #cccccc;
 height: 18px;
 border-left: 2px outset #ffffff; 
 border-right: 2px outset #ffffff;
 color:#000000;
 border-top: 2px outset #ffffff;
 padding-top: 2;
 height:20
}
.l-h{
 background-color: #cccccc; 
 border-left: 2px outset #ffffff ;
 border-top: 2px outset #ffffff;
 color:#000000;
}
.l-c{
 background-color: #cccccc;
 border-top: 2px outset #ffffff 
}
.l-r {
 background-color: #cccccc;
 border-right: 2px outset #ffffff;
 border-top: 2px outset #ffffff;
 color:#000000;
}
.l-hc{
 background-color: #cccccc;
 border-left: 2px outset #ffffff;
 color:#000000;
}
.l-cc{
 background-color: #cccccc;
 color:#000000;
}
.l-rc {
 background-color: #cccccc;
 border-right: 2px outset #ffffff;
 color:#000000;
}
td{
 color:#000000;
}
-->
</style>
<title>显示属性</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body style="border:outset 1 #ffffff;margin: 0;background-color: #cccccc;padding:3px" scroll=no>
<SCRIPT LANGUAGE="JavaScript">
<!--
function restore()
{
td1.className="l";
td2.className="l";
td3.className="l";
td4.className="l";
td5.className="l";
td6.className="l";
td_1.className="l-h";
td_2.className="l-c";
td_3.className="l-c";
td_4.className="l-c";
td_5.className="l-c";
td_6.className="l-c";
w1.style.display="none";
w2.style.display="none";
w3.style.display="none";
w4.style.display="none";
w5.style.display="none";
w6.style.display="none";
}
function c1()
{
td1.className="lc";
td_1.className="l-hc";
w1.style.display="block";
}
function c2()
{
td2.className="lc";
td_2.className="l-cc";
w2.style.display="block";
}
function c3()
{
td3.className="lc";
td_3.className="l-cc";
w3.style.display="block";
}
function c4()
{
td4.className="lc";
td_4.className="l-cc";
w4.style.display="block";
}
function c5()
{
td5.className="lc";
td_5.className="l-cc";
w5.style.display="block";
}
function c6()
{
td6.className="lc";
td_6.className="l-cc";
w6.style.display="block";
}
//-->
</SCRIPT>
<form name="free" method="post" target="_target">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="400" height="61">
<tr>
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c1();>
<div id="td1" class="lc">背景</div></td>
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c2();>
<div id="td2" class="l">屏保</div></td>
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c3();>
<div id="td3" class="l">外观</div></td>
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c4();>
<div id="td4" class="l">Web</div></td>
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c5();>
<div id="td5" class="l">效果</div></td> 
<td width="50" height="20" align="center" 
valign="bottom" onclick=restore();c6();>
<div id="td6" class="l">设置</div></td>
<td width="50" height="20" align="center" valign="bottom" ></td>
<td width="50" height="20" align="center" valign="bottom"></td>
</tr>
<tr style="">
<td width="50" height="1" align="center" class="l-hc" id="td_1" > </td>
<td width="50" height="1" align="center" class="l-c" id="td_2"> </td>
<td width="50" height="1" align="center" class="l-c" id="td_3"> </td>
<td width="50" height="1" align="center" class="l-c" id="td_4"> </td>
<td width="50" height="1" align="center" class="l-c" id="td_5"> </td> 
<td width="50" height="1" align="center" class="l-c" id="td_6"> </td>
<td width="50" height="1" align="center" class="l-c" id="td_"> </td>
<td width="50" height="1" align="center" class="l-r" id="td_"> </td>
</tr>
<tr>
<td width="398" height="360" class="up" colspan="8"
style="border-top-style: solid; border-top-width: 0; padding: 5">
<p align="center"> 
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" 
width="100%" height="325">
<tr>
<td width="100%" height="280">
<div align="center">
<center>
<div style="display:" id=w1><h1>1</h1></div>
<div style="display:none" id=w2><h1>2</h1></div>
<div style="display:none" id=w3><h1>3</h1></div>
<div style="display:none" id=w4><h1>4</h1></div>
<div style="display:none" id=w5><h1>5</h1></div>
<div style="display:none" id=w6><h1>6</h1></div>
</center>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</center>
<tr>
<td width="398" height="37" colspan="8" 
style="border-top-style: solid; border-top-width: 0; padding: 5">
<p align="right"><input type="button" value="确定" name="_ok" 
style="width: 60;height:22" class="up"> 
<input type="button" value="取消" name="_cancel"
style="width: 60;height:22" class="up" onclick="window.close();"> 
<input type="button" value="应用(A)" name="_apply" 
style="width: 60;height:22" disabled class="up">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

运行效果如下:

希望本文所述对大家的javascript程序设计有所帮助。

相关文章

  • 详解使用Next.js构建服务端渲染应用

    详解使用Next.js构建服务端渲染应用

    这篇文章主要介绍了详解使用Next.js构建服务端渲染应用,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2018-07-07
  • 详解js跨域原理以及2种解决方案

    详解js跨域原理以及2种解决方案

    这篇文章主要介绍了js跨域原理以及解决方案,跨域问题是由于javascript语言安全限制中的同源策略造成的,想要进一步了解跨域的朋友可以参考本文进行学习
    2015-12-12
  • 前端实现截屏的两种常见方式

    前端实现截屏的两种常见方式

    这篇文章主要介绍了前端实现截屏的两种常见方式,分别是使用第三方库html2canvas和navigator.mediaDevices.getDisplayMedia,两种方法都给出了详细的代码示例,需要的朋友可以参考下
    2025-03-03
  • 很棒的js选项卡切换效果

    很棒的js选项卡切换效果

    很棒的JavaScript选项卡切换效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2016-07-07
  • JavaScript Event学习第四章 传统的事件注册模型

    JavaScript Event学习第四章 传统的事件注册模型

    在这一章我会讲解给元素注册事件的最好的一种办法,那就是:确保一个特定的事件在特定的HTML元素上发生并且能运行特定的脚本。
    2010-02-02
  • 使用Three.js制作一个3D奖牌页面

    使用Three.js制作一个3D奖牌页面

    本文将使用React+Three.js技术栈,制作一个专属的3D奖牌页面,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起动手试一试
    2022-01-01
  • layui中layer前端组件实现图片显示功能的方法分析

    layui中layer前端组件实现图片显示功能的方法分析

    这篇文章主要介绍了layui中layer前端组件实现图片显示功能的方法,结合实例形式分析了layui中layer组件调用图片显示功能的操作方法与相关注意事项,并提供了layer与layui源码下载,需要的朋友可以参考下
    2017-10-10
  • JavaScript中数据过滤的几种常见方法

    JavaScript中数据过滤的几种常见方法

    JavaScript是一种广泛使用的编程语言,它提供了多种方法来对数据进行过滤,在本文中,我们将介绍JavaScript中常见的几种数据过滤方法,并提供相应的示例,感兴趣的朋友跟随小编一起看看吧
    2023-10-10
  • 用javascript实现自定义标签

    用javascript实现自定义标签

    用javascript实现自定义标签...
    2007-05-05
  • JavaScript自定义Promise实现流程

    JavaScript自定义Promise实现流程

    现在网上有非常多的Promise文章,但都是给你一堆代码,或者某些核心代码,让你看完之后感觉,嗯,很厉害,但还是不知所云,不知其所以然。那么本文真正从一个小白开始带你深入浅出,一步一步实现自己的 Promise,这种自己造轮子的过程一定是进步最快的过程,快上车开始吧
    2022-10-10

最新评论