【发布时间】:2013-10-24 15:02:30
【问题描述】:
下面我有一个“按钮”(只是一个带有图标的跨度),它在我的应用程序中创建一个 div 的弹出视图,以允许用户在单独的窗口中比较信息。
但是,我得到如下 Asp.Net 错误:
**“/”应用程序中的服务器错误。
找不到资源。 请求的 URL:/Home/[object Object]**
有没有人知道为什么会发生这种情况?以下是我的代码:
<div class="module_actions">
<div class="actions">
<span class="icon-expand2 pop-out"></span>
</div>
</div>
<script>
$(document).ajaxSuccess(function () {
var Clone =
$(".pop-out").click(function () {
$(this).parents(".module").clone().appendTo("#NewWindow");
});
$(".pop-out").click(function popitup(url) {
LeftPosition = (screen.width) ? (screen.width - 400) / 1 : 0;
TopPosition = (screen.height) ? (screen.height - 700) / 1 : 0;
var sheight = (screen.height) * 0.5;
var swidth = (screen.width) * 0.5;
settings = 'height=' + sheight + ',width=' + swidth + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no, directories=no,titlebar=no,location=no,addressbar=no'
newwindow = window.open(url, '/Index', settings);
if (window.focus) { newwindow.focus() }
return false;
});
});
【问题讨论】:
-
如果你用 + 替换 ',' 行 window.open 会得到什么?
-
如果我添加 url + "Index" + 设置我得到请求的 URL:/Home/[object Object]/Indexheight=540,width=960,top=380,left=1520,scrollbars=yes ,resizable=yes,toolbar=no,status=no,menu=no,directories=no,titlebar=no,location=no,addressbar=no 如果我添加 url + "Index" , 设置 /Home/[object Object]/索引
-
您上面的代码会将窗口的标题设置为 '/Index' 我假设这就是您想要的标题...如果应该将其附加到 url 那么您应该放一个 + 那里...但是...您仍然需要修复 url 以连接有效的 url 而不是 javascript 对象。
-
@Kevin 谢谢你,jsut 解决了我的问题!
标签: c# javascript jquery asp.net asp.net-mvc-4