我正在寻求 Javascript/HTML 中的“更多信息”脚本的帮助。
当前代码:
<div id="information">
Content
<div id="more_information" style="display:none;">
More content
</div>
<a href="#" onclick="showhide('more_information');">More information</a>
</div>
Javascript:
function showhide(layer_ref) {
if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) {
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) {
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
info = document.getElementById(layer_ref);
info.style.display = state;
}
}
干杯