Alternative JavaScript usage: bookmarklet (bookmarklet)

Source: Internet
Author: User
In fact IE There is no such statement as "bookmarks ". Firefox In IE, it is called "favorites ".
We can use these bookmarks to implement many practical and interesting functions.
For example, if you do not like the color settings of the current page, you can change the color on your own.
The effect is as follows:

To restore it, refresh the page.

The procedure is as follows (for example, IE6 is slightly different from other browsers ):
1.Add a page to favorites.
2.Select this favorites, right-click its properties (U), Enter the following JSCode:Javascript:Void(Document. bgcolor='Green');

Click OK. The following prompt is displayed:

Select OK , Bookmark creation OK!
Open the Baidu homepage and click the custom bookmarks in the favorites folder to see if the background color of the page is your favorite.
If your JS technology is high enough, you can define many functions by yourself. You can play games or make similar small calculators, unit conversion, online dictionaries, etc. Give full play
The following are some useful bookmarks.
1. Web Security Color Table Javascript: VaR I, J, K, L, t = ' <Table width = 100%> ' , C = New Array ( ' 00 ' , ' 33 ' , ' 66 ' , ' 99 ' , ' CC ' , ' FF ' ); For (I = 0 ; I < 6 ; I ++ ){ For (J = 0 ; J < 6 ; J ++ ) {T + =   ' <Tr> ' ; For (K = 0 ; K < 6 ; K ++ ) {L = C [I] + C [J] + C [k]; t + = ' <TD bgcolor = # ' + L + ' > ' + L + ' </TD> ' } T + ' </Tr> ' }} Void (Document. Body. innerhtml = T + ' </Table> ' );


2. Change the font color of the current page

Javascript: If (Frames. Length < 1 ){ Void (Document. fgcolor = Prompt ( ' Change to which text color? ' , '' ))} Else {Alert ( ' Page has frames .! ' )}

3. Verify the current pageJavascript:Void(Window. Open ('Http://validator.w3.org/check? Uri ='+Window. Location. href,'','Width = 700, Height = 800, status = Yes, resizable = Yes, scrollbars = Yes, location = Yes'));

In addition, we recommend a website,
Www.bookmarklets.com. Various bookmarks are provided here and can be obtained directly from there. If you like a bookmark, you can right-click it to add it to favorites.

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.