Recently popular sogo cloud input methods and QQ cloud input methods use bookmarklet technology. Bookmarks are originally used to collect web sites (http://momo.site.com/), but in fact Bookmarks can also collect javascript code
You only need to replace the url in the bookmarks with javascript code.
The Code is as follows:
Javascript: your_javascript_expression
The above javascript: can be considered as a javascript protocol, just like http: is an http protocol.
The URL for starting the jQuery bookmarks is as follows:
The Code is as follows:
Javascript :(
Function (jquery_node ){
Var disable = function (src_node ){
Src_node.parentNode.removeChild (src_node );
JQuery. noConflict (1 );
};
Var enable = function (d, j ){
J = d. createElement ('script ');
J. id = 'jquery _ src_code ';
J. src = 'HTTP: // ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js ';
D. getElementsByTagName ('head') [0]. appendChild (j );
};
!! Jquery_node? Disable (jquery_node)
: Enable (document );
}) (Document. getElementById ('jquery _ src_code '))
To add users to favorites on a webpage, you need to put it into a link.
For example:
The Code is as follows:
Start jQuery
All the code is:
The Code is as follows:
Href ="
Javascript :(
Function (jquery_node ){
Var disable = function (src_node ){
Src_node.parentNode.removeChild (src_node );
JQuery. noConflict (1 );
};
Var enable = function (d, j ){
J = d. createElement ('script ');
J. id = 'jquery _ src_code ';
J. src = 'HTTP: // ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js ';
D. getElementsByTagName ('head') [0]. appendChild (j );
};
!! Jquery_node? Disable (jquery_node)
: Enable (document );
}) (Document. getElementById ('jquery _ src_code ') ">
Start jQuery
The result is as follows:
Start jQuery
You can add the above bookmarks to your favorites (right-click and click "add this link as a bookmark ");
FireBug --- Console. Try jQuery's charm.
JQuery ('A ');
$ ('A') may be invalid because window. $ objects (including other js libraries or $ objects defined by the website) may exist at the beginning)
The cnblogs website uses the jQuery library.