Jquery 单击按钮时如何重定向浏览器?
我想在点击按钮时传递一个URL,以便浏览器可以重定向到该URL url值=Jquery 单击按钮时如何重定向浏览器?,jquery,Jquery,我想在点击按钮时传递一个URL,以便浏览器可以重定向到该URL url值=/web/SMI6041001090/home?contId=186&contName=sa 当用户单击按钮时,它应该重定向到此URL var url = document.<portlet:namespace />regForm.fwdURL.value; alert('url -->'+url); jQuery('.submit-button').click(function(){ // P
/web/SMI6041001090/home?contId=186&contName=sa
当用户单击按钮时,它应该重定向到此URL
var url = document.<portlet:namespace />regForm.fwdURL.value;
alert('url -->'+url);
jQuery('.submit-button').click(function(){
// Pass URL here.
});
var url=document.regForm.fwdURL.value;
警报('url-->'+url);
jQuery('.submit按钮')。单击(函数(){
//在这里传递URL。
});
我想在的clik上传递URL
按钮所以浏览器可以重定向到
网址
你是说:
var url = document.<portlet:namespace />regForm.fwdURL.value;
jQuery('.submit-button').click(function(){
document.location.href = 'http://yoursite.com' + url;
});
var url=document.regForm.fwdURL.value;
jQuery('.submit按钮')。单击(函数(){
document.location.href=http://yoursite.com“+url;
});
不确定您到底在问什么?sAc,document.location和window.location有什么区别?@fearofahackplanet:您可以使用其中一种,location
是window/document
对象的属性。@fear:document.location最初在某些浏览器中是只读的。正因为如此,window.location始终是将浏览器定向到其他位置的首选方法,但现在这并不重要。谢谢,sAC,这就是我想要的接受你的答案。