2016-10-22 136 views
-2

我試圖從一個HTML頁面值傳遞給另一個html頁面,但我得到了一些錯誤..如何將數值從一個html頁面傳遞到使用javascript的另一個html頁面?

下面

是我的html頁面一個代碼:

<!DOCTYPE html> 
    <html> 
    <head> 
    <script type="text/javascript"> 
     function first() { 
      location.href = "onclick2.html"; 
     } 
    </script> 
    </head> 
    <body> 
    <button onclick="first()" >Home</button> 
    <form action="onclick2.html" method="post"> 
    <input type="text" name="sender" /> 
    <input type="submit" value="send"/> 

    </form> 
    </body> 
    </html> 
下面

是我的HTML頁2代碼

<!DOCTYPE html> 
    <html> 
    <head> 
    <script type="text/javascript"> 
     function first() { 
      location.href = "onclick.html"; 
     } 
    </script> 
    </head> 
    <body> 
     <button onclick="first()">Home2</button> 
     <form action="onclick.html" method="get"> 
     <input type="text" name="reciver" /> 

    </body> 
+2

你的錯誤是什麼? –

+0

我完全不明白你想要做什麼。你能詳細解釋一下嗎? –

+0

值不會從一頁傳遞到另一頁...... – Dep

回答

0

您可以在URL傳遞價值和轉讓其下面給出:

location.href = "http://www.domainname.com/login.html?FirstName=admin&LastName=admin" 
相關問題