如题所述
<!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>
温馨提示:答案为网友推荐,仅供参考
第1个回答 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>