开发者

jquery programmatic popup window

I'm new to Jquery, so please bear with me. I'm trying to create a function that will programmatically open popup windows. I'm running the following code in Firefox, and it seems to work except that the popup windows disregards the toolbar/menubar/scrollbars/resizable/location parameters (they are still visible/functional and I would like to disable all of them):

wparams[0] = {windowURL:"site.html",height:100,width:100,left:500,top:500,toolbar:0,menubar:01,scrollbars:0,resizable:0,location:0}

var launchWindow = function(p)
{
    $('.popup').popupWindow(wparams[p]).trigger("click"); 
}

var begin = function()
{
        launchWindow(0);
}

I would like the popups I'm using jQuery-swip popup plugin (http://swip.codylindley.com/popupWindowDemo.html), am wondering what's wrong with the above code.

Also, when I try to run this code in chrome/safari (typing begin(); in the co开发者_如何学Gonsole) it returns undefined, whereas in Firefox it runs. I'm also confused as to why this is happening.

Thanks.


I didn't understand 'when' you want to open the popup, if when the page complete loading, so it should be

$(document).ready(function() {
launchWindow(0);
});

Also can you explain to me why use trigger(click)??? As of the plugin documentation, this should work like that

var launchWindow = function(p)
{
    $('.popup').popupWindow(wparams[p]); 
}


Does this work?

wparams[0] = {windowURL:"site.html","height:100,width:100,left:500,top:500,toolbar:0,menubar:01,scrollbars:0,resizable:0,location:0"}


That's a weird way to define the "wparams" array - what happens if you do this:

var wparams = [
   {windowURL:"site.html", height:100, width:100, left:500, top:500, toolbar:0, menubar:01, scrollbars:0, resizable:0, location:0}
];

It's not really clear why you're setting that up as an array; I guess maybe there might be other popup configurations stored in it. If that's the case, you'd just write them inside those square brackets, separated by commas.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜