开发者

Make links contained in jQuery DOMWindow open in same window

I have a jQuery DOMWindow that's loaded with AJAX on one of my web pages. For various technical reasons, I have to use AJAX instead of iFrames to load the content. Currently, any hyperlinks located inside the DOMWindow cause the browser to reload a new page instead of simply opening the content inside the same DOMWindow.

Is there any way to开发者_开发百科 make a hyperlink open inside the same DOMWindow. I have tried including target="_self" in the hyperlink code.

This is the configuration of my jQuery DOMWindow:

                $('.AjaxDOMWindow').openDOMWindow({
                anchoredClassName:'DOMWindow',
                draggable: 1,
                eventType:'click',
                height:500,
                loader:1,
                loaderHeight:16,
                loaderImagePath:'/js/jquery/DOMWindow/animationProcessing.gif',
                loaderWidth:17,
                positionLeft:0,
                positionTop:0,
                positionType:'centered',
                width:700,
                windowHTTPType:'get',
                windowSource:'ajax'
            });

This is the hyperlink in question:

<a href="/foo/foo/edit_map_pin_more.htm?mAddressBox0=FALSE&width=800&height=600&mPin_ID=5"><b>View More Icons</b></a>


I think call to Dom window plugin is not binded to anchor tag. I Placed above function in document.ready function which binds after dom has loaded and it worked.

$(document).ready(function(){
    $(AjaxDOMWindow ).openDOMWindow({         
        anchoredClassName:'DOMWindow',
        draggable: 1,
        eventType:'click',
        height:500,
        loader:1,
        loaderHeight:16,  
        loaderImagePath:'/js/jquery/DOMWindow/animationProcessing.gif', 
        loaderWidth:17,
        positionLeft:0,
        positionTop:0,
        positionType:'centered',
        width:700,
        windowHTTPType:'get',
        windowSource:'ajax'
    });
}); 


I guess the problem is that there's no window in the true sense. There's just a div inside the main page acting as DOMWindow. So any links in that div will surely refresh the main doc.

Keep everything the same and add this:

$('.AjaxDOMWindow a').live("click", function(){
    $(this).openDOMWindow({
        anchoredClassName:'DOMWindow',
        draggable: 1,
        eventType:'click',
        height:500,
        loader:1,
        loaderHeight:16,
        loaderImagePath:'/js/jquery/DOMWindow/animationProcessing.gif',
        loaderWidth:17,
        positionLeft:0,
        positionTop:0,
        positionType:'centered',
        width:700,
        windowHTTPType:'get',
        windowSource:'ajax'
    });
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜