日期:2014-05-16 浏览次数:20372 次
<!doctype html> <meta charset=utf-8> <html> <head> <title>Demo</title> </head> <body> <style> .main_wrapper{width:500px;height:250px;margin:0 auto;} #main{width:500px;height:200px;border:1px solid red;} </style> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <div class="main_wrapper"> <div id="main"></div> <input id="testBtnLeft" type="button" value="<<Left" /> <input id="testBtnRight" type="button" value="Right>>" /> </div> <script> /* *数据来源可能过ajax异步获取 * */ var id = 8; $("#testBtnLeft").click(function(){ window.location.href="#?id="+(--id); $("#main").empty().html("LEFT::::::this is a test "+id); }); $("#testBtnRight").click(function(){ window.location.href="#?id="+(++id); $("#main").empty().html("RIGHT::::::data data data data data data "+id); }); </script> </body> </html>
------解决方案--------------------
这个效果很好