Bookmarklet to start jQuery (IMITATING cloud Input Method) _ jquery

Source: Internet
Author: User
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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.