开发者

Injecting JQuery into a live webpage via the DOM and Opera Extensions

I'm building an Opera Extension.

开发者_如何学JAVAIs it possible to use the includes folder to directly inject jquery into the live html on a webpage.

I.E. change the background colour of the DOM to say black.

possibly so this script could work.

// The injected script

var elems = document.getElementsByTagName("body");

var arr = jQuery.makeArray(elems);

$(document).ready(function() {
$("body").css("background-color", "#000000");
 $("body").css("color", "#ffffff");
 $(arr).appendTo(document.body);

});

if it is possible could someone please do a tutorial or point me to one as I cant visualise how to do this in my mind.

thanks kev


You could try pulling apart this extension https://addons.opera.com/addons/extensions/details/scripter-script-includer/ to see how he did it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜