开发者

Include JavaScript File in a Bookmarklet

I want to use jQuery in my Bookmarklet. I included the source to my bookmarklet.js into the bookmarklet, so there is no more place for the jQuery File.

I've tried this to include jQuery inside the included bookmarklet.js

var s=document.createElement('script');
s.setAttribute('src','http://jquery.com/src/jquery开发者_如何学JAVA-latest.js');
document.getElementsByTagName('body')[0].appendChild(s);

But it doesn't work. What did I do wrong?


try adding one more attribute to specify the type of the source file:

s.setAttribute('type', 'text/javascript');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜