简体   繁体   English

Asp.Net MVC4中的Javascript / Jquery弹出窗口

[英]Javascript/Jquery pop-up window in Asp.Net MVC4

Below I have a "button" (just a span with an icon) that creates a pop-up view of a div in my application to allow users to compare information in seperate windows. 在下面,我有一个“按钮”(带有图标的跨度),可在我的应用程序中创建div的弹出视图,以允许用户在单独的窗口中比较信息。

However, I get and Asp.Net Error as follows: 但是,我得到和Asp.Net错误如下:

* *Server Error in '/' Application. * *“ /”应用程序中的服务器错误。

The resource cannot be found. 无法找到该资源。 Requested URL: /Home/[object Object] ** 要求的网址:/ Home / [object Object] **

Does anyone have an Idea of why this is happending? 有谁知道为什么会这样? Below is my code: 下面是我的代码:

<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;
   });
});

Your code above will set the title of the window to be '/Index'. 上面的代码会将窗口的标题设置为“ / Index”。 If you wanted that to be part of the URL you'll need to change that to a + to concatenate it to the url string. 如果您希望将其作为URL的一部分,则需要将其更改为+以将其连接到url字符串。 However you still have a problem with your url because wherever you are constructing your url you are appending an object rather than a string to the end of it. 但是,您的网址仍然存在问题,因为无论您在哪里构造网址,都将在其末尾附加一个对象而不是字符串。

[object Object]

Is how javascript concatenates an object onto a string and clearly based on the error message the window is requesting a malformed url. javascript是如何将对象连接到字符串上,并清楚地基于窗口请求格式错误的错误消息的错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.net MVC 4 Razor在弹出窗口中上传图像 - ASP.net MVC 4 Razor Upload Image In Pop-Up Window 使用ASP.Net中的C#为弹出窗口输出CSV文件 - to output CSV file for pop-up window using C# in ASP.Net 如何在ASP.NET Web应用程序中打开弹出窗口? - How to open pop-up window in ASP.NET web application? (ASP.NET)如何执行此操作:在GridView中单击按钮以打开包含另一个Gridview的弹出窗口 - (ASP.NET) How to do this: Button click in GridView to open pop-up window containing another Gridview 如何使button_Click事件在ASP.NET的弹出窗口中打开页面? - How to make the button_Click event opens the page in a pop-up window in ASP.NET? 如何在ASP.NET Datagrid中弹出日历? - How to pop-up a calendar inside an ASP.NET Datagrid? 在ASP.NET中调用弹出的“确认”消息框 - Invoking a pop-up 'confirm' message box in ASP.NET 在MVC4中多次单击按钮打开弹出窗口的问题? - Issue in opening pop-up window by clicking button multiple times in MVC4? 在本地主机mvc4中发布应用程序后,数据未使用弹出窗口保存在数据库中? - The data is not saving in db using Pop-up Window after publish the application in Local host mvc4? 使用MVC4中的弹出窗口添加数据后,该值在下拉菜单中显示两次。 - The value is displaying two times in drop down after adding the data using pop-up window in MVC4?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM