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');
精彩评论