MVC 中用JS跳转窗体Window.Location.href
一般的Window.Location.href会造成URL地址追加
较为好的写法为:
return Content(string.Format("<script type='text/javascript'>alert('请先维护实验前提条件!');window.location.href='{0}'</script>", Url.Action("OfflineLab", "OfflineLab", new { labType = Server.UrlEncode(topic), conditionDesc = unit })));
①要是有中文参数的话,需要加 Server.UrlEncode(中文参数)传递到控制器的action中;
②接收中文参数的话,则为 string labType = Server.UrlDecode(labType);
转载于:https://www.cnblogs.com/yisheng/archive/2012/10/16/2726801.html
MVC 中用JS跳转窗体Window.Location.href相关推荐
- window location href跳转无效
问题情况 JS中设置window.location.href跳转无效 原因是 a标签的href跳转会执行在window.location.href设置的跳转之前: 如果是表单form的话 也会先执行 ...
- window location href is not a function错误解决
js报错:window.location.href is not a function是由于写法问题以及浏览器不兼容导致的,具体解决方法如下: 错误js写法: window.location.href ...
- 关于js中window.location.href、location.href 等如何跳转
关于js中"window.location.href"."location.href"."parent.location.href".&qu ...
- Window.location.href命令在JS中跳转无效或自动忽略
最近在做一个跳转本页面后提示信息window.location.href只能跳转一次,之后就自动忽略了.在下面加事件返回值即可跳转成功,注意:若在form提交函数中,则不会提交表单:若在超链接标签中, ...
- js如何获取window.location.href跳转后查询字符串的值?
$("#worked_count").parent().attr("onClick","window.location.href='view/warn ...
- 关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法
关于js中"window.location.href"."location.href"."parent.location.href".&qu ...
- js中window.location.href,location.href,parent.location.href,top.location.href的用法
"window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...
- asp.net mvc 地址栏传输信息报错:window.location.pathname
asp.net mvc 地址栏传输信息报错:window.location.pathname 前端cshtml代码内容 代码片. // 页面跳转 window.location.pathname = ...
- window.location.href跳转无效 IE Bug【转载】
window.location.href跳转的ie bug 2010-10-25 17:36 http://support.microsoft.com/kb/190244/en-us 在ie下,< ...
最新文章
- 使用XML记录数据的一些体会
- android 怎么加链接地址,Android TextView添加超链接的方法示例
- getpeername()函数
- C++ Primer 5th笔记(chap 18 大型程序工具) 重载与命名空间
- [codevs 1916] 负载平衡问题
- How to remove the dotted border on Active link state---移除链接激活时出现的虚线
- 在Windows XP中对系统文件(页面文件和注册表)进行碎片整理
- mysql8.0 tar安装_CentOS7安装MySQL8.0 tar包
- kafka基础之介绍和分布式集群搭建
- java中子类继承父类时是否继承构造函数
- SAP NOTE远程下载及电子证书配置
- 安卓手机上最好的3个azw3阅读器
- java开源项目-六个经典的 SpringBoot 练手项目
- 双向链表排序 c++
- 计算机卸载打不开,电脑卸载wps后excel打不开怎么办
- SSDB:高性能数据库服务器
- oracle sqlplus 退格,Oraclesqlplus中方向键、退格键的使用
- DC-4靶场练习—teehee提权
- [iOS] MUI-WebView模式集成到iOS应用
- HTML——表格、表格嵌套、表格布局