我在一个页面上有以下脚本,该页面有一个显示/隐藏某些内容的按钮。我想从另一个页面获得一个链接,该链接将转到此页面并打开/显示其中一个项目的内容。这可能吗?
这是我用于显示/隐藏的onpage脚本和标记;
注意:'{trailitem:count}'只是一个ExpressionEngine标记,用于为每个div添加唯一编号。 ExpressionEngine遍历并创建具有增量编号的div,但概念是相同的,所以想象一系列具有唯一ID的div。
<script>
function ToggleTrail{trailitem:count}() {
var toggler = document.getElementById("trail_toggler{trailitem:count}");
var first = document.getElementById("trail_first{trailitem:count}");
var reveal = document.getElementById("trail_reveal{trailitem:count}");
if(reveal.style.display != "block" && toggler.style.display != null) {
toggler.style.display = "block";
toggler.innerHTML = '» Hide';
first.style.display = "block";
reveal.style.display = "block";
}else{
toggler.style.display = "block";
toggler.innerHTML = '» Reveal More';
first.style.display = "block";
reveal.style.display = "none";
}
return false;
}
</script>
<div class="trailbox">
<a id="trail_toggler{trailitem:count}" class="button blackbutton viewallbutton" href="#" onclick="return ToggleTrail{trailitem:count}();">» Reveal More</a>
<div id="trail_first{trailitem:count}">
First content
</div>
<div id="trail_reveal{trailitem:count}">
Content to be revealed
</div>
</div>