我有一个弹出窗口的代码:
<script type="text/javascript">
function post_to_url(path, params, method) {
popup = window.open("", "Chat", "scrollbars=no ,resizable=yes");
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = popup.document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for (var key in params) {
if (params.hasOwnProperty(key)) {
var hiddenField = popup.document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
popup.document.body.appendChild(form);
form.submit();
}
function login_to_chat() {
var path = "/resources/livehelperchat/lhc_web/index.php/site_admin/chat/chattabs/";
var params = {
'lhc_user': '<?=$_SESSION['
lhc_user '];?>',
'lhc_password': '<?=$_SESSION['
lhc_password '];?>'
};
post_to_url(path, params, "POST");
}
</script>
我有一个链接打开这个弹出窗口并调用login_to_Chat():
<a href="javascript:login_to_chat();" title="">Support Chat</a>
在IE中它工作正常 - 窗口显示和我发布的页面正确加载。 它在Chrome中不起作用 - 弹出窗口显示,但没有任何内容被加载。
有什么建议吗?