<input type="submit" id="serch" value="確定" style="width: 40px; height: 20px; font-size: 11px;" οnclick="closeD()" /><br />
參考網站:
:
http://www.blogjava.net/xlth2006/archive/2009/12/15/306065.html
showModalDialog的用法:
http://baike.baidu.com/view/2813452.htm
2、子窗口:
@model QP.Model.DataWindow.VendorGridArgumentViewModel
@using QP.Web.Render
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>docList</title>
<base target="_self">
<script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#OK").click(function () {
var docAll = null;
$("input[name=check]").each(function () {
if ($(this).attr("checked")) {
var doc = $(this).val();
if (doc != null) {
if (docAll == null)
docAll = doc;
else
docAll = docAll + "," + doc;
}
}
});
window.returnValue = docAll;
window.close();
});
});
function onLoads() {
var a = window.parent.dialogArguments;
if (a.length > 0) {
var docList = a.split(",");
for (var i = 0; i < docList.length ; i++) {
docValue(docList[i]);
}
}
}
//將已被選擇的信息在此默認勾上
function docValue(docList) {
//獲得界面中多選框的個數
var count = document.getElementById("count").value;
for (var i = 1; i <= count; i++) {
if (document.getElementById(i).checked == false) {
var doc = document.getElementById(i).value;
if (doc == docList) {
document.getElementById(i).checked = true;
}
}
}
}
function Cancel() {
window.close();
}
/*
function isOk() {
//返回一個值
var docAll = null;
var count = document.getElementById("count").value;
for (var i = 1; i <= count; i++)
{
//將被選中的內容用,分開放到一個變量中傳到父窗口中
if (document.getElementById(i).checked == true)
{
var doc = document.getElementById(i).value;
if (doc != null)
{
if (docAll == null)
docAll = doc;
else
docAll = docAll + "," + doc;
}
}
}
window.returnValue =docAll;
window.close();
}
*/
</script>
</head>
<body οnlοad="onLoads()">
<div>
<p>請選擇:</p>
@{
IEnumerable<QP.Model.DataWindow.VendorGridEntity> list = ViewData["_docList_"] as IEnumerable<QP.Model.DataWindow.VendorGridEntity>;
if (list != null)
{
<input type="hidden" id="count" name="count" value=@list.Count() />
var i = 1;
foreach (var doc in list)
{
<input type="checkbox" name="check" id=@i value=@doc.Venno >@doc.Venno</input><br/>
i=i+1;
}
}
}
</div>
<div>
<input type="submit" id="OK" value="確定" style="width: 40px; height: 20px; font-size: 11px;" />
<input type="button" value="取消" style="width: 40px; height: 20px; font-size: 11px;" οnclick="Cancel()" />
</div>
</body>
</html>
3、在對應的Controller中打開子窗口的方法