Popup window not opening on IE7

≯℡__Kan透↙ 提交于 2019-12-13 02:15:02

问题


Hi Javascript gurus, I have this Javascript code which is working fine on Firefox , but it is not working on IE 7. Any ideas why?

Here is the code

function TestWindow()
{
     SimpleWindow('Default.aspx', 'Simple Test', 200, 200, 'yes')
}

function SimpleWindow(mypage,myname,w,h,scroll)
{

    var win= null;

    var winl = (screen.width-w)/2;


    var wint = (screen.height-h)/2;

    settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no'

    win=window.open(mypage,myname,settings)

    if(parseInt(navigator.appVersion) >= 4)
        {
            win.window.focus();
        }
    }

回答1:


You may have realized that IE is giving the error "Invalid argument."

IE doesn't seem to like window names with spaces in them. Change 'Simple Test' to 'SimpleTest' etc.




回答2:


For myname parameter use only a-zA-Z0-9 characters. IE doesn't like any other, especially whitespace characters.




回答3:


Check popup blockers




回答4:


Check for reserved words. Your parameter name "scroll" is probably messing up your code in IE.



来源:https://stackoverflow.com/questions/1100320/popup-window-not-opening-on-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!