js实现翻页功能?
请大侠帮我用js实现翻页功能,把源码贴上来,谢谢!我下面的代码点击“>”调用page_next()函数后,隐藏了id=news_zh_5和id=news_zh_6,让id=news_zh_7,和id=news_zh_8显示了一下,但最后还是还原成id=news_zh_5和id=news_zh_6显示,id=news_zh_7,和id=news_zh_8隐藏,为什么?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var showit = "block";
var hideit = "none";
function show_hide(el,shownow)
{
if(document.all)
document.all(el).style.display = (shownow) ? showit : hideit ;
else if(document.getElementById)
document.getElementById(el).style.display = (shownow) ? showit : hideit ;
}
function init()
{
show_hide("news_zh_7",false);
show_hide("news_zh_8",false);
show_hide("news_zh_5",true);
show_hide("news_zh_6",true);
}
function page_next()
{
alert("1");
show_hide("news_zh_7",true);
show_hide("news_zh_8",true);
show_hide("news_zh_5",false);
show_hide("news_zh_6",false);
alert("2");
}
</script>
</head>
<body onload="init();">
<div class="pagebar">
<a href="" onclick="page_pre();"> < </a> 01 <a href="" onclick="page_next();"> > </a>
</div><br /><br /><br />
<div id="news_zh_7">33333333333333333</div><br />
<div id="news_zh_8">44444444444444444</div><br />
<div id="news_zh_5">1111111111111111</div><br />
<div id="news_zh_6">22222222222222222</div>
</body>
</html>