简体   繁体   English

添加书签Javascript进行阻止?

[英]Adding Bookmarklet Javascript to Block?

Hello i've been trying to do this for about 2 years. 您好,我一直在尝试这样做约2年。 I think it worked once but ever since then i just can't make it happen again. 我认为它曾经工作过一次,但从那以后我就再也做不到。 Im adding this code to a block- 我将这段代码添加到一个块中

<a href="javascript:u=document.location.href;t=document.title; s=window.getSelection();
void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));">Test</a>

When i try to drag that to my browser the url comes out as so- 当我尝试将其拖到浏览器中时,网址显示为-

javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(

I am using the Full HTML filter option and isnt adding line breaks or anything. 我正在使用“完整HTML”过滤器选项,没有添加换行符或其他任何内容。 If i edit the link in my browser and add just 如果我在浏览器中编辑链接并仅添加

javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));

Things work great. 一切正常。 I have looked about and have asked here previously http://drupal.org/node/235074 我已经浏览过,并曾在这里询问过http://drupal.org/node/235074

I must just be missing something so simple as it seems the whole internet doesnt have this problem. 我一定只是想念一些简单的东西,因为似乎整个互联网都没有这个问题。 All help appreciated thanks. 所有帮助表示感谢。

Reg` Reg`

I think the problem is with the double-quotes in your window.open() call. 我认为问题出在window.open()调用中的双引号中。

The browser thinks that you're closing the href="javascript... " 浏览器认为您正在关闭href="javascript... "

Replace the double quotes in "http://onlinebanter.com/node/add/web2ob?edit[title]=" with single quotes. 用单引号替换"http://onlinebanter.com/node/add/web2ob?edit[title]="中的双引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM