window.openでサブウィンドウを「開いたら意図した動作をするのですが、
window.showModalDialogで開いたら以下のエラーになってしまいます。
0x800a138f - JavaScript 実行時エラー: 未定義または NULL 参照のプロパティ 'document' は取得できません
window.opener.document.forms[0]の部分がいけないと思うのですが、
サブウィンドウの開き方くらいしか変わらないと思うのでなぜエラーがでるのかわかりません。
ご教示おねがいします。
selectOutputForm.js
javascript
1function showNewWindow(manageNo) { 2 var url = '../SelectOutputForm/ExcelOutput?no=' + manageNo; 3 4 var userAgent = window.navigator.userAgent.toLowerCase(); 5 if (userAgent.indexOf('trident/7') != -1) { 6 showModalDialog(url, window, 'dialogheight:200px;dialogwidth:260px;'); 7 } else { 8 open(url, window, 'dialogheight:200px;dialogwidth:260px;'); 9 } 10} 11 12function outputExcel() { 13 var manageNo = getManageNo(); 14 var url = '../Excel/Present?no=' + getManageNo(); 15 sendPostNewWindow(window.opener.document.forms[0], url); 16 close(); 17}
サブウィンドウ
html
1<html> 2<head> 3 <meta name="viewport" content="width=device-width" /> 4 <title>ExcelOutput</title> 5 <link href="@Url.Content("~/css/selectOutputForm.css")" rel="stylesheet" type="text/css" /> 6 <script type="text/javascript" src="@Url.Content("~/Scripts/original.js")"></script> 7 <script type="text/javascript" src="@Url.Content("~/Scripts/selectOutputForm.js")"></script> 8</head> 9<body> 10 <h1>対応するMicrosoft Excel のバージョンを選択してください。</h1> 11 <table> 12 <tr> 13 <td> 14 <div class="button"> 15 <input type="button" name="xlxsButton" style="width:200px;" value="Microsoft Excel 2007以降" onclick="outputExcel();"> 16 </div> 17 </td> 18 </tr> 19 </table> 20</body> 21</html>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/30 01:08