2013-06-03 136 views
0

我正在使用一個簡單的HTML按鈕來提交數據。我正在使用codeigniter框架。以下代碼是我的按鈕,用於收起頁面並返回上一頁。通過按鈕傳遞網址

<input type="button" value="Cancel" onclick="" class="cancel_button"> 

當我點擊取消按鈕就應該到以下網址

http://localhost/sample/categorycontroller/index 

請讓我知道,如何通過按鈕傳遞的URL。?

在此先感謝

+0

onclick =「history.go(-1);」 ???只是去上一頁? – swapnesh

回答

0

請用戶這樣的:

<input type="button" value="Cancel" onclick="window.location.href = 'http://localhost/sample/categorycontroller/index'" class="cancel_button"> 
2

試試這個:

<input type="button" value="Cancel" onclick="window.location = 'http://localhost/sample/categorycontroller/index'" class="cancel_button"> 
+0

謝謝@利多..它完美的工作..感謝您看我的問題和答案..謝謝很多 – bhai

0
<input type="button" value="Cancel" onclick="goBack()" class="cancel_button"> 

然後創建一個名爲Javascript函數goBack()

<script type="text/javascript"> 

function goBack() { 
    window.location = 'http://localhost/sample/categorycontroller/index'; 
} 

</script>