打开一篇文章:
全局变量:
var prevContent=null;
var prevAbstract=null;
function showdiv(obj) {
if (prevContent!=null) {prevContent.style.display = "none";prevAbstract.style.display = "block";}
x.style.display="block"; obj.parentNode.style.display = "none";
prevContent=x;prevAbstract = obj.parentNode;}
全局变量:
var prevContent=null;
var prevAbstract=null;
function showdiv(obj) {
if (prevContent!=null) {prevContent.style.display = "none";prevAbstract.style.display = "block";}
x.style.display="block"; obj.parentNode.style.display = "none";
prevContent=x;prevAbstract = obj.parentNode;}
@10110001 解决点击全文浏览器的滚动条滚动到顶页的问题:
将a标签的href设为javascript:; 如下,
<a href="javascript:;" onclick="showdiv(this)">全文</a>
<a href="javascript:;" class="btn" onclick="hidediv(this)">收起全文</a>
将a标签的href设为javascript:; 如下,
<a href="javascript:;" onclick="showdiv(this)">全文</a>
<a href="javascript:;" class="btn" onclick="hidediv(this)">收起全文</a>
2018-03-27