如何从MVC4中的链接编写弹出窗口 [英] How to code a popup from a link in MVC4
本文介绍了如何从MVC4中的链接编写弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的代码用于MVC4中的链接弹出:
< link rel = stylesheet href = http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css < span class =code-keyword> / >
< script src = 〜/ Scripts / jquery-1.9.1.js type = text / javascript > < / script >
< script src = 〜/ Scripts /jquery-ui-1.10.3.custom.min.js\" type = text / javascript > < / script >
< h2 > popup < / h2 >
@ Html.ActionLink(打开,弹出,新{@class =openDialog})
< ; div id < span class =code-keyword> = dialog-Box 样式 = background-color:white;边框:薄实心#0101DF;宽度:100px;高度:100px >
< p > hai < / p >
< / div >
< script type = text / jscript >
$( '#dialog-Box')。对话框({
autoOpen:false,
height:500,
width:700,
resizable:false,
modal:true
});
$('。openDialog')。click(function(){
var theURL = $(this).attr( 'href' 属性);
$('#dialog-Box')。load(theURL,function(){
$(this).dialog('open');
});
});
< / script >
但弹出窗口无效
请帮我这样做我不熟悉MVC
解决方案
('#dialog-Box')。dialog({
autoOpen:false,
height:500,
width:700,
resizable:false,
modal:true
});
('。openDialog')。click(function(){
var theURL =
(this).attr('href');
Hi,
I have code like this for a popup from link in MVC4:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="~/Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script src="~/Scripts/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<h2>popup</h2>
@Html.ActionLink("open", "popup", new { @class = "openDialog" })
<div id="dialog-Box" style="background-color: white; border: thin solid #0101DF;width: 100px; height: 100px">
<p>hai</p>
</div>
<script type="text/jscript">
$('#dialog-Box').dialog({
autoOpen: false,
height: 500,
width: 700,
resizable: false,
modal: true
});
$('.openDialog').click(function () {
var theURL = $(this).attr('href');
$('#dialog-Box').load(theURL, function () {
$(this).dialog('open');
});
});
</script>
but the popup is not working
please help me in doing this i am new to MVC
解决方案
('#dialog-Box').dialog({ autoOpen: false, height: 500, width: 700, resizable: false, modal: true });
('.openDialog').click(function () { var theURL =
(this).attr('href');
这篇关于如何从MVC4中的链接编写弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文