如何使用 JQuery-UI 对话框重定向到主页?
我在 DotNetNuke 模块中使用以下 JQuery 块:
jquery(document).ready(function (){
$( "#dialog:ui-dialog").dialog("destroy");
$( "#dialog-message").dialog({
modal: true,
buttons: {
Ok: function(){
$( this ).dialog("close");
}
}
});
});
</script>
<div id="dialog-message" title="Registration Confirmed">
我不确定当用户单击“确定”按钮时如何将用户重定向到主页?另外,如何连接对话框消息 DIV 以仅在单击 ASP:Button 时触发?
非常感谢!!
I'm using the following JQuery block in my DotNetNuke module:
jquery(document).ready(function (){
$( "#dialog:ui-dialog").dialog("destroy");
$( "#dialog-message").dialog({
modal: true,
buttons: {
Ok: function(){
$( this ).dialog("close");
}
}
});
});
</script>
<div id="dialog-message" title="Registration Confirmed">
I'm not sure how to redirect the user to the home page when they click the Ok button? Also, how do I wire up the dialog-message DIV to only fire when my ASP:Button is clicked?
Thanks much!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 Button 上放置一个 OnClientClick 并调用一个显示模态框的函数。单击“确定”按钮后,您可以将 window.location 更改为主页的路径。
HTML
Javascript
编辑
一般来说,JavaScript 和 Web 开发中可以使用两种类型的路径:相对路径和绝对路径。
相对路径:从当前目录开始,使用“/”前进目录和“../' 向后
绝对路径:所需位置的完整 url
您可以找到更全面的描述 此处
'~/' 是一个服务器端“快捷方式”,不幸的是,如果不使用 this.ResolveClientUrl。
You can put an OnClientClick on your Button and call a function that will show your modal. When the ok button is clicked you can change the window.location to the path of your homepage.
HTML
Javascript
Edit
There are two types of paths that can be used in javascript and in web development in general: relative paths and absolute paths.
Relative paths: start from the current directory and you access the desired location from there using '/' to go forward a directory and '../' to go backward
Absolute paths: the full url to the desired location
You can find a more thorough description here
'~/' is a sever side "shortcut" that unfortunately does not work on the client side without using something like this.ResolveClientUrl.
客户端
client side