iframe相关笔记
/// 合同到期日期弹窗 function popWin1(url, title, width, height) { if (title == "") { title = "详情"; } if (width == null || width == undefined || width == "") { width = 900; } if (height == null || height == undefined || height == "") { height = 600; } artDialog.open(url, { title: title, width: width, height: height, lock: true, opacity: 0.5, ok: function() { var n = $("iframe")[0].contentWindow.$("#mth").text();//获取ifram中参数值 $.ajax({ type: "POST", url: "@Url.Content("~/TchContract/SetRemind")", data: "value=" + n, success: function (data) { popAlert("保存成功!", function () { window.location = "@Url.Content("~/TchContract/Index")"; }, "success"); } }); } }); }
//在主页面操作ifram中内容
//替换提交 function SubmitChange() { var OldquestinId = $("iframe")[0].contentWindow.$("#OldquestinId").val(); var newquestinId = $("iframe")[0].contentWindow.$("#newquestinId").val(); var questionType = $("iframe")[0].contentWindow.$("#questionType").val(); if (newquestinId == -1) { $("iframe")[0].contentWindow.$("#tips").css('display', 'block'); return false; } var datas = { "oldQuestionId": OldquestinId, "newQuestionId": newquestinId, "questionType": questionType }; $.ajax({ type: "post", async: false, url: "@Url.Action("Replace", "AssessSuper")", data: JSON.stringify(datas), dataType: "json", contentType: "application/json", success: function (data) { if (data.ResultType == 8 && !!data.ResultMessage) { window.parent.location.href = "/user/logon?loginTip=" + data.ResultMessage; return; } else if (typeof (data) == "object" && data.ResultType == 9) { window.parent.location.href = "/SuperAdmin/CourseLoading/Index"; return; } else { location.reload(); } } }); return true; }