点击a显示a-点击b隐藏a! a 和 b分别是两个div标签。帮忙用 js或 jq实现,谢谢
2个回答
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
div {display:none;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fun(o) {
if (o.innerText == 'a')
{
document.getElementById("a").style.display = "block";
document.getElementById("b").style.display = "none";
}
else {
document.getElementById("b").style.display = "block";
document.getElementById("a").style.display = "none";
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<a href='#' onclick='fun(this);'>a</a>|<a href='#' onclick='fun(this);'>b</a>
<div id="a">aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br></div>
<div id="b">bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br></div>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
div {display:none;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fun(o) {
if (o.innerText == 'a')
{
document.getElementById("a").style.display = "block";
document.getElementById("b").style.display = "none";
}
else {
document.getElementById("b").style.display = "block";
document.getElementById("a").style.display = "none";
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<a href='#' onclick='fun(this);'>a</a>|<a href='#' onclick='fun(this);'>b</a>
<div id="a">aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br></div>
<div id="b">bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>bbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br></div>
</BODY>
</HTML>
2013-04-19
展开全部
<div onclick="javascript:document.getElementById("a").style="display: block;" id="a"></div>
<div id="b" onclick="javascript:document.getElementById("a").style="display: none;"></div>
<div id="b" onclick="javascript:document.getElementById("a").style="display: none;"></div>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询