javascript - Popup window not opening on IE7 - Stack Overflow

Hi Javascript gurus, I have this Javascript code which is working fine on Firefox , but it is not worki

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();
        }
    }

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();
        }
    }
Share Improve this question edited Jul 8, 2009 at 20:25 Ateş Göral 140k27 gold badges141 silver badges191 bronze badges asked Jul 8, 2009 at 20:17 ShivaShiva 1,4092 gold badges16 silver badges32 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 5

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.

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

Check popup blockers

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745295207a4621097.html

相关推荐

  • javascript - Popup window not opening on IE7 - Stack Overflow

    Hi Javascript gurus, I have this Javascript code which is working fine on Firefox , but it is not worki

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信