JAVASCRIPT+CSS实现隐藏显示的问题求助

来源:百度知道 编辑:UC知道 时间:2024/06/06 02:43:30
以下代码用来实现这样一种效果,点击某一链接后将该链接对应的原本不显示的内容显示出来

基本思路应该没有错,但就是运行不出效果,请DX们指点,另外,还有更简洁的办法吗?在线等!!!

<style>
.box {color: #FFF;width:95%;margin:0 auto;padding:10px;order:1px solid #AFBDC6;color:#333333;background-color: #EEF3F6;clear:both;display:none;}
</style>

<Script>
function show(abc){
abc.style.display = abc.style.display == "none" ? "" : "none";
}
</Script>

<p><a href="javascript:show(ALIAS1);">单击此处会切换是否显示详细内容1</a></p>
<div class="box" id="ALIAS1">
<p>1、平时不显示的内容</p>
</div>

<p><a href="javascript:show(ALIAS2);">单击此处会切换是否显示详细内容2</a></p>
<div class="box" id="ALIAS2">
<p>2、平时不显示的内容</p>
</div>

<p><a href="javascript:show(ALIAS3);">单击此处会切换是否

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function show(obj){
obj.style.display=obj.style.display=="none"?"":"none";
}
//-->
</SCRIPT>
<a href="javascript:" onclick="show(document.getElementById('asd'))">点我</a>
<div id="asd" style="