0

以下のjavascript/htmlは、ユーザー画面の右下に小さなポップアップウィンドウを作成します。このコードはChromeとFirefoxで機能しますが、何らかの理由でIEv9では機能しません。

IE9デバッガーでは、次のように表示されます。行:17エラー:引数が無効です。

17行目はvarwin= window.open(..。

デバッガーでは、次のように表示されます。

HTML1202: http://xyzserver:8080/path/test_popup.html is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked. 

SCRIPT87:引数が無効です。test_popup.html、17行目文字3

var win=..のvである文字

誰かアイデアはありますか?

<!DOCTYPE html>
<html>
<head>
<script>
function open_win(data) 
{
  var w = 200;
  var h = 200;
  var left = (screen.width - (w * 1.1)); 
  var top  = (screen.height - (h * 1.1));

  var win = window.open('', 'about:blank', 'width=' + w + ',  height=' + h + ', top=' + top + ', left=' + left);
  win.document.write("<p>Received: " + data + "</p>")
  win.focus()
}
</script>
</head>

<body>
<form>
<input type="button" value="Open Window" onclick="open_win('information here')">
</form>
</body>

</html>
4

2 に答える 2

3

2番目の引数( IEではabout:blank明らかに。が含まれていない可能性があるウィンドウ名)ではなく、最初の引数として渡す必要があります:

于 2013-01-27T12:45:40.487 に答える
0

これを試して:

var win = window.open('', '', 'width=' + w + ',  height=' + h + ', top=' + top + ', left=' + left);

'about:blank'Microsoftは2番目の引数として名前をサポートしていないためです。

または、次のように言う必要がありwindow.open('_blank', '', 'width='...)....etcます。最初の引数として名前を指定します。

于 2013-01-27T12:45:54.933 に答える