2016-07-14 134 views
1

幫助。我想將一個按鈕鏈接到另一個按鈕。我有兩個.html文件。HTML/Javascript如何將一個按鈕鏈接到另一個按鈕?

index.html,然後output.html

這裏是我的index.html我有一個表格,並在表格的按鈕的情況下, 。只是一個例子

<div id="additionForm"> 
    <form class="form-addition"> 
    Assume that this form requests for two values and will add that values. 
    <button type="submit"">ADD</button> 
    </form> </div> 

然後假設當ADD(提交)按鈕被點擊時,將被引導到output.html這將顯示結果。

在output.html中,如何創建I按鈕,如果按下該按鈕,它會「調用」index.html中的窗體?

例如, 我按下了output.html上的按鈕 必須調用index.html中的表單。

謝謝。

+0

當你說在output.html形式將「通話」中的index.html形式究竟是什麼意思呢?你的意思是它會提交以前收集的值的早期形式?或者你的意思是它可以讓你回到上一頁? –

+0

index.html中的表單將出現在output.html中,然後我將輸入另一個值,如果我按提交,它將再次計算。從output.html頁面點擊該按鈕 – Djamez

+0

爲什麼你不把這兩個表單放在那裏?你想要什麼有點奇怪。你能否提供進一步的信息「計算」意味着什麼以及數據會發生什麼? – user3528269

回答

0

你可以試試這個

<div id="outputForm"> 
<form class="form-output"> 
<button type="button" onclick="location.href='index.html'">Click Me!</button> 
</form> </div> 
0
<div id="outputForm"> 
    <form class="form-output"> 
    <button type="button" onclick="call()">Click Me!</button> 
    </form> </div> 

    <script> 
    function call() 
    { 
     window.location.href ='index.html' 
    } 
</script> 
+0

儘管此代碼可能會回答這個問題,但提供有關如何解決問題和/或爲什麼解決問題的其他上下文會提高答案的長期價值。 – HiDeo

相關問題