2013-06-03 49 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>