解决方法
如果你想滚动自己的标签控件,你可以这样做:
<html> <head> <script type="text/javascript"> function activateTab(pageId) { var tabCtrl = document.getElementById('tabCtrl'); var pageToActivate = document.getElementById(pageId); for (var i = 0; i < tabCtrl.childNodes.length; i++) { var node = tabCtrl.childNodes[i]; if (node.nodeType == 1) { /* Element */ node.style.display = (node == pageToActivate) ? 'block' : 'none'; } } } </script> </head> <body> <ul> <li> <a href="javascript:activateTab('page1')">Tab 1</a> </li> <li> <a href="javascript:activateTab('page2')">Tab 2</a> </li> ... </ul> <div id="tabCtrl"> <div id="page1" style="display: block;">Page 1</div> <div id="page2" style="display: none;">Page 2</div> ... </div> </body> </html>