解决方案 »
- 为什么Firefox中的cookie通过工具插件可以看,但js代码中使用document.cookie无法获取??
- js 解析xml 跨浏览器
- js中如何获取字符串的后四位?
- 如何将标签圈起来
- jQuery读取form中的值
- 动态替换DIV的innerHTML时IE死掉(替换内容为嵌入对象)
- 我用微软的TreeView,用Javascript如何遍历它所有节点阿?在线等!解决了就结分
- 当按下按钮时,页面的Label(HTML控件)的内容变成文本框中的内容?
- 这种需求的正则如何写
- vue 引入element ui 失败
- 选中复选框出一文本框
- 页内锚记的目标显示位置是不是只有顶部和底部呢?有在页面下拉条充足的情况下能显示在页面的中间的办法吗?
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<style>
ul,li{padding:0;margin:0;list-style:none;}
ul#remindSetTab li{width:120px;border:1px #ccc solid;border-bottom:1px solid #ccc;float:left;margin-right:2px;display:block;height:24px;line-height:24px;vertical-align:middle;text-align:center;color:#666;position:relative;z-index:2;background:#EEE;cursor:pointar}
#DataSet{border:1px solid #CCC;width:100%;height:300px;position:relative;z-index:1;top:-1px}
ul#remindSetTab li:first-child{margin-left:10px;border-bottom:1px solid #FFF;background:#FFF}
#DataSet{clear:both}
</style>
<script>
function MenuClick(obj,sValue){
var tag = document.getElementsByTagName("li")
var data = document.getElementById("DataSet")
for (var i=0;i<tag.length;i++ )
{
tag[i].style.background="#EEE"
tag[i].style.borderBottom="1px solid #CCC"
obj.style.background = "#FFF"
obj.style.borderBottom = "1px solid #FFF" }
data.innerHTML = sValue
}
</script>
</head> <body>
<ul id="remindSetTab">
<li onclick="MenuClick(this,'新闻1')">新闻1</li>
<li onclick="MenuClick(this,'新闻2')">新闻2</li>
<li onclick="MenuClick(this,'新闻3')">新闻3</li>
<li onclick="MenuClick(this,'新闻4')">新闻4</li>
</ul>
<div id="DataSet">新闻1</div>
</body>
</html>
http://blog.csdn.net/theforever/archive/2010/08/23/5832244.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<title>520</title>
<style type="text/css">
<!--
body{ padding:0;font:12px "宋体"; }
textarea{
height: 96px;
width: 100px;
margin-top: 0px;
top: 0px;
}
/*选项卡1*/
#lib_Tab1{
width:200px;
padding:0px;
float: left;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 15px;
margin-left: 0px;
}
/*选项卡2*/
#lib_Tab2{
width:200px;
padding:0px;
margin-bottom:0px;
float: left;
margin-top: 0px;
margin-right: 0px;
margin-left: 20px;
}
#lib_Tab3{
width:230px;
padding:0px;
margin-bottom:0px;
float: left;
margin-top: 0px;
margin-right: 0px;
margin-left: 15px;
}
.q0{
height: 68px;
width: 250px;
position: absolute;
top: 204px;
left: 150px;
}
.q1{
height: 16px;
width: 30px;
border: thin solid #3399FF;
float: left;
}
.q2{
height: 16px;
width: 30px;
border: thin solid #3399FF;
float: left;
margin-left: 10px;
}
.q3{
height: 16px;
width: 40px;
border: thin solid #3399FF;
float: left;
clear: right;
margin-left: 10px;
}
.q4{
height: 16px;
width: 40px;
border: thin solid #3399FF;
float: left;
clear: right;
margin-left: 10px;
}
/*菜单class*/
.lib_tabborder{
border:1px solid #95C9E1;
}
.lib_Menubox {height:28px;line-height:28px;position:relative;}.lib_Menubox ul{margin:0px;padding:0px;list-style:none; position:absolute; top:3px; left:0; margin-left:10px; height:25px;text-align:center;}
.lib_Menubox li{
float:left;
display:block;
cursor:pointer;
width:40px;
color:#949694;
font-weight:bold;
margin-right:2px;
height:25px;
line-height:25px;
background-color:#E4F2FD
}
.lib_Menubox li.hover{
padding:0px;
background:#fff;
width:40px;
border-left:1px solid #95C9E1;
border-top:1px solid #95C9E1;
border-right:1px solid #95C9E1;
color:#739242;
height:25px;
line-height:25px;
}
.lib_Contentbox{
clear:both;
margin-top:0px;
border-top:none;
height:95px;
text-align:center;
padding-top:8px;
}
.lib_Contentbox div{
top: -7px;
margin-top: 0px;
position: relative;
}
-->
</style></head>
<body>
<div id="lib_Tab1">
<div class="lib_Menubox lib_tabborder">
<ul>
<li id="one1" onclick="setTab('one',1,3)" class="hover">新闻1</li>
<li id="one2" onclick="setTab('one',2,3)" >新闻2</li>
<li id="one3" onclick="setTab('one',3,3)" >新闻3</li>
</ul>
</div>
<div class="lib_Contentbox lib_tabborder">
<div id="con_one_1" ><textarea id="one1d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻1a1</div>
<div id="con_one_2" style="display:none"><textarea id="one2d" onmouseover="this.focus()" onfocus="this.select()">234656</textarea>新闻2a2</div>
<div id="con_one_3" style="display:none"><textarea id="one3d" onmouseover="this.focus()" onfocus="this.select()"></textarea>新闻3a3</div>
</div>
</div>
<div id="lib_Tab2">
<div class="lib_Menubox lib_tabborder">
<ul>
<li id="two1" onclick="setTab('two',1,4)" class="hover">新闻4</li>
<li id="two2" onclick="setTab('two',2,4)" >新闻5</li>
<li id="two3" onclick="setTab('two',3,4)" >新闻6</li>
<li id="two4" onclick="setTab('two',4,4)" >新闻7</li>
</ul>
</div>
<div class="lib_Contentbox lib_tabborder">
<div id="con_two_1" ><textarea rows="4" id="two1d" onmouseover="this.focus()" onfocus="this.select()"></textarea>
新闻4b1</div>
<div id="con_two_2" style="display:none"><textarea id="two2d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻5b2</div>
<div id="con_two_3" style="display:none"><textarea id="two3d" onmouseover="this.focus()" onfocus="this.select()">587346</textarea> 新闻6b3</div>
<div id="con_two_4" style="display:none"><textarea id="two4d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻7b4</div>
</div>
</div>
<div id="lib_Tab3">
<div class="lib_Menubox lib_tabborder">
<ul>
<li id="three1" onclick="setTab('three',1,5)" class="hover"> 新闻8</li>
<li id="three2" onclick="setTab('three',2,5)" > 新闻9</li>
<li id="three3" onclick="setTab('three',3,5)" > 新闻10</li>
<li id="three4" onclick="setTab('three',4,5)" > 新闻11</li>
<li id="three5" onclick="setTab('three',5,5)" > 新闻12</li>
</ul>
</div>
<div class="lib_Contentbox lib_tabborder">
<div id="con_three_1" ><textarea id="three1d" onmouseover="this.focus()" onfocus="this.select()"></textarea>
新闻8a1</div>
<div id="con_three_2" style="display:none"><textarea id="three2d" onmouseover="this.focus()" onfocus="this.select()">dsd</textarea> 新闻9a2</div>
<div id="con_three_3" style="display:none"><textarea id="three3d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻10a3</div>
<div id="con_three_4" style="display:none"><textarea id="three4d" onmouseover="this.focus()" onfocus="this.select()">fvhnd</textarea> 新闻11a4</div>
<div id="con_three_5" style="display:none"><textarea id="three5d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻12a4</div>
</div>
</div>
<div class="q0">
<div class="q1"><a href="#one2d" onclick="theforever('one',2,3)">新闻2</div>
<div class="q2"><a href="#two3d" onclick="theforever('two',3,4)">新闻6</div>
<div class="q3"><a href="#three2d" onclick="theforever('three',2,5)">新闻9</div>
<div class="q4"><a href="#three4d" onclick="theforever('three',4,5)">新闻11</div>
</div>
</body>
<script>
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
if(i=cursel)
document.getElementById(name+i+"d").focus();
}
function theforever(name,cursel,n){
setTab(name,cursel,n);
var con=document.getElementById("con_"+name+"_"+cursel);
con.style.backgroundColor='#99CC99';
}
/*
function theforever1()
{
document.getElementById("con_one_2").style.display = "block";
document.getElementById("con_one_1").style.display = "none";
document.getElementById("con_one_3").style.display = "none";
document.getElementById("one2").className = "hover";
document.getElementById("one1").className = "";
document.getElementById("one3").className = "";
document.getElementById("one2d").focus();
document.getElementById('one2d').parentNode.style.backgroundColor='#99CC99';
}
function theforever2()
{
document.getElementById("con_two_3").style.display = "block";
document.getElementById("con_two_1").style.display = "none";
document.getElementById("con_two_2").style.display = "none";
document.getElementById("con_two_4").style.display = "none";
document.getElementById("two3").className = "hover";
document.getElementById("two1").className = "";
document.getElementById("two2").className = "";
document.getElementById("two4").className = "";
document.getElementById("two3d").focus();
document.getElementById('two3d').parentNode.style.backgroundColor='#99CC99';
}
function theforever3()
{
document.getElementById("con_three_2").style.display = "block";
document.getElementById("con_three_1").style.display = "none";
document.getElementById("con_three_3").style.display = "none";
document.getElementById("con_three_4").style.display = "none";
document.getElementById("con_three_5").style.display = "none";
document.getElementById("three2").className = "hover";
document.getElementById("three1").className = "";
document.getElementById("three3").className = "";
document.getElementById("three4").className = "";
document.getElementById("three5").className = "";
document.getElementById("three2d").focus();
document.getElementById('three2d').parentNode.style.backgroundColor='#99CC99';
}
function theforever4()
{
document.getElementById("con_three_4").style.display = "block";
document.getElementById("con_three_1").style.display = "none";
document.getElementById("con_three_2").style.display = "none";
document.getElementById("con_three_3").style.display = "none";
document.getElementById("con_three_5").style.display = "none";
document.getElementById("three4").className = "hover";
document.getElementById("three1").className = "";
document.getElementById("three2").className = "";
document.getElementById("three3").className = "";
document.getElementById("three5").className = "";
document.getElementById("three4d").focus();
document.getElementById('three4d').parentNode.style.backgroundColor='#99CC99';
}*/
</script>
</html>
有没有办法一个函数搞定了?