开发者

Make specific link open in a new window with jquery

I'm looking for the abili开发者_如何学Goty when a link contains, for example /schedule/ in the address, only this link will open in a new window when clicked. I have a series of 5,000+ links that need to open in a new window, which I would need to update manually (no find/replace available), which contains /schedule/ in the address field and I need them all to open in a new window.

This script will enable external links to open in a new window, but can someone please assist if the link contains /schedule/ in the address field? the external algorithm can be removed. Also, can it include a width + height constraint such as 500 x 600?

UPDATED WITH SOLUTION

add this to your library to append the width & height: http://plugins.jquery.com/project/open

<script type="text/javascript">
     $(document).ready(function(){ 
        $("a[href*='/schedule/']").open
          ({
            width:800,
            height:600,
            location:true,
            toolbar:true,
            resizeable:true,
            scrollbars:true
          }); 
      });
</script>


try this:

$("a[href*='/schedule/']").attr('target','_blank');

For width / height constraints you need to open a popup window (lookup window.open...) or use a modal window that can load external content into an iframe.


same as the one you have but with the Contains selector

$("a[href*='/schedule/']").attr('target','_blank');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜