Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Prototype中重新实现外部弹出jQuery代码?_Javascript_Jquery_Popup_Prototypejs - Fatal编程技术网

Javascript 如何在Prototype中重新实现外部弹出jQuery代码?

Javascript 如何在Prototype中重新实现外部弹出jQuery代码?,javascript,jquery,popup,prototypejs,Javascript,Jquery,Popup,Prototypejs,我在jQuery中有这段代码,我想用原型库重新实现它 // make external links open in popups // this will apply a window.open() behaviour to all anchor links // the not() functions filter iteratively filter out http://www.foo.com // and http://foo.com so they don't trigger off

我在jQuery中有这段代码,我想用原型库重新实现它

// make external links open in popups
// this will apply a window.open() behaviour to all anchor links
// the not() functions filter iteratively filter out http://www.foo.com 
// and http://foo.com so they don't trigger off the pop-ups

jQuery("a[href='http://']").
      not("a[href^='http://www.foo.com']").
      not("a[href^='http://foo.com']").
      addClass('external');

jQuery("a.external").
      not('a[rel="lightbox"]').click( function() {
      window.open( jQuery(this).attr('href') );
      return false;
});

如何使用jQuery中列出的not运算符的等效项迭代筛选元素集合?

可以使用如下拒绝方法进行筛选:

$$('a').reject(function(element) { return element.getAttribute("href").match(/http:\/\/(www.|)foo.com/); }).invoke("addClassName", "external");

可以使用如下所示的拒绝方法进行过滤:

$$('a').reject(function(element) { return element.getAttribute("href").match(/http:\/\/(www.|)foo.com/); }).invoke("addClassName", "external");