我有一些链接,单击该链接将取消隐藏内容,然后再次单击后将显示所有内容。我在google docs上使用,它将无法正常工作。我也在使用CSS。链接显示了,但是javascript和CSS不会为我或其他人编译。
function toggle() {
var ele = document.getElementById("toggleText");
var text = document.getElementById("displayText");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "Musis List";
}
else {
ele.style.display = "block";
text.innerHTML = "Musis List ▼";
}
}
#title a:link { color: #38761D; text-decoration: none !important; }
#title a:visited {
color: #38761D; text-decoration: none !important;
}
#title a:hover{
color: #4EA628;
background-color:transparent;
text-decoration: none !important;
}
#title a:active {
color: #4EA628; text-decoration: none !important;
}
#title a {
text-decoration: none !important;
display:block;
border-bottom: 0px solid #38761D;
font-family: Verdana, sans-serif;
font-weight: bold;
font-size: large;
line-height: 1.26;
}
<center>
<div id="title" >
<a id="displayText" href="javascript:toggle();">Musis List</a>
</div>
<div id="toggleText" style="display: none">
Here will be a list of music....
</div>
<br />
<br />
<br />
<script language="javascript">
function toggle1(id) {
var ele = document.getElementById("toggleText1");
var text = document.getElementById("displayText1");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "Video List";
}
else {
ele.style.display = "block";
text.innerHTML = "Video List ▼";
}
}
</script>
<div id="title" >
<a id="displayText1" href="javascript:toggle1(1);">Video List</a>
</div>
<div id="toggleText1" style="display: none">Here will be a list of videos....</div>
</center>
让我知道,是否有人可以提供帮助。我会感谢队友。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句