2012-10-16 69 views
1

我想製作一個Web應用程序,其中有多個頁面我希望當我點擊任何鏈接時,它應該移動到該頁面我從網站上獲得的代碼工作正常但我想,它不使用ancchor標籤如何在單個html文件中添加多個頁面

 <html> 
    <head> 
     <script> 
    function show(shown, hidden) { 
    document.getElementById(shown).style.display='block'; 
     document.getElementById(hidden).style.display='none'; 
    return false; 
    } 
    </script> 
    </head> 
    <body> 


    <div id="Page1"> 
    Content of page 1 
    <a href="#" onclick="return show('Page2','Page1');">Show page 2</a> 
    </div> 

    <div id="Page2" style="display:none"> 
    Content of page 2 
    <a href="#" onclick="return show('Page1','Page2');">Show page 1</a> 
    </div> 

    </body> 
    </html> 
+0

我可能是錯的(因爲我避免了html5和其他奇特的新網絡技術,因爲我年紀大了,脾氣暴躁),但是你聲明你的javascript是正確的(可以說

相關問題