点击 RSS 源时弹出 - Javascript
我想设置网站,以便当用户单击 RSS 源链接(我在网站的一部分中显示)时,源链接会显示在弹出窗口中。这在网站上是有道理的。这是我的用户想要的东西。
我不知道如何填充我正在拉动的 rss 链接,让它们在弹出窗口中打开。
我得到了这个:
$(document).ready(function(){
$("a[href^='http']").attr('target','_blank');
});
它确实会在新窗口中打开链接。我可以添加另一行,如下所示:
$("a[href^='http']").attr('onClick','openpopup()');
但我不确定如何编写一些 javascript 来 1)从锚点获取 href; 2)用javascript(void)替换它; 3)使用该网址,如下所示:
function openpopup() {
window.open("url","","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=1250,height=500,left=250,top=175").blur(); window.focus();}
有什么想法吗?
I want to set up the site so when users click on RSS feed links (which I display in part of the site), the feed link appears in a pop under. It makes sense on the site. It's something my users want.
What I can't figure out is how to populate the rss links that I'm pulling to get them to open in a pop under.
I've got this:
$(document).ready(function(){
$("a[href^='http']").attr('target','_blank');
});
which does open the link in a new window. I can add another line like this:
$("a[href^='http']").attr('onClick','openpopup()');
but I'm not sure how to craft some javascript that will 1) grab the href from the anchor; 2) replace it with a javascript(void); 3) use that url in something like this:
function openpopup() {
window.open("url","","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=1250,height=500,left=250,top=175").blur(); window.focus();}
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不太懂 jQuery,但这应该可以
Not much of a jQuery guy, but this should work