[英]Redirecting to the root using javascript
In my project I have the following script in order to open a page: 在我的项目中,我具有以下脚本以打开页面:
<script type="text/javascript">
function setPage(pName) {
var iPage = "'" + pName + "'";
document.getElementById('iFrame').src = window.location.href(iPage);
}
</script>
when I run the program it gives me the following problematic url: 当我运行程序时,它给我以下有问题的网址:
Requested URL
http://localhost:7819/Pages/Account/'http:/localhost:7819/Pages/Support/Asp/Help01.aspx'
As we see the address contain the url of the current page plus the requested url. 如我们所见,该地址包含当前页面的网址以及所请求的网址。
More of it I'm loosing the second slash /
in http:/
which I have it all the way inside the script. 更多的是,我在http:/
失去了第二个斜杠/
,在脚本中一直使用它。
How can I solve this issue? 我该如何解决这个问题?
I assume, you wanted something like this? 我想,您想要这样的东西吗?
<script type="text/javascript">
function setPage(pName) {
document.getElementById('iFrame').src = pName;
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.