Implement IE Some menu commands

xiaoxiao2021-03-06  110

Whenever we see the open, print, advance, saving, back, close this window, disable the link to implement the browser command, and if you have paind to implement it, is it unfortunate? Do you want to achieve? If you can implement your browser's command on the web page, how much interesting is! Let's take a look at how to use the JavaScript code to implement the browser menu command (the following code is called in the browser under Windows XP).

First, the implementation of the command in the file (f)] menu

1. Implementation of the Open command

[Format]: Document.execCommand ("Open") [Description] This is a bit similar to the command in the webbrowser control in the programming design of VB, and everyone can think about it. [Example] Join between : open

2. Implementation of using Notepad Edit〗

[Format]: Location.replace ("View-source:" location) [Description] Opens the notepad, showing the source code for the web page in Notepad. [Example] Add:

3, save the implementation of the command

[Format]: Document.execCommand ("SaveAs") [Description] Save the page to your local disk! [Example] Add: : > Save as

4, the implementation of the print command

[Format]: Document.execCommand ("print") [Description] Of course, you have to install the printer! [Example] Join between : print

5, the implementation of the closure command

[Format]: window.close (); return false [Description] will turn off this window. [Example] Join between : Off This window

Second, the implementation of the command in the editing (e)] menu

Implementation of the full selection command [Format]: Document.execCommand ("SELECTALL") [Description] Will all the contents of the selected web page! [Example] Join between : all select

Third, the implementation of the command in the "View (V)] menu

1. Implementation of the refresh〗 command

[Format]: location.reload () or history.go (0) [Description] The browser re-open this page. [Example] Add: or join: Refreshing 2, the implementation of the source file〗 command

[Format]: Location.Replace ("View-source:" location) [Description] View the source code for the page. [Example] Join between : View Source File

3, the implementation of the full screen display

[Format]: Window.open (Document.Location, "URL", "Fullscreen") [Description] full screen displays this page. [Example] Join between : full screen display

Fourth, the implementation of the command in the collection (a)] menu

1. Implementation of the Add to Favorites

[Format]: Window.external.Addfavorite ('URL', '"Website Name") [Description] Add this page to your favorites. [Example] Add in : Add Go to favorites

2. Implementation of the finishing collection〗 command

[Format]: Window.external.ShowBrowSerui ("Organizefavorites", NULL) [Description] Opens the finishing Favorites dialog. [Example] Add in : Find Collection

5. Implementation of the command in the tool (T)] menu

Internet Options Implementation

[Format]: Window.external.ShowBrowSerui ("PrivacySettings", NULL) [Description] Opens the Internet Options dialog. [Example] Add in : 31/A>

6. Implementation of the command in [Toolbar]

1, the implementation of the forward command

[Format] History.go (1) or history.forward () [Description] The browser opens a page. [Example] Join between : or join: Forward 2, the implementation of the back command

[Format]: History.go (-1) or history.back () [Description] The browser returns the previous browsing page. [Example] Add in : or join: Back

3. Implementation of the refresh command

[Format]: Document.Reload () or history.go (0) [Description] The browser re-open this page. [Example] Add: or join: Refreshing

7. Implementation of other orders

〖Time Close This window command is implemented [Format]: SetTimeout (Window.close (), off time) [Description] will close this window. [Example] Join between :

If you have also organized other commands implemented with JavaScript, you may wish to share with you.

[Attach] In order to facilitate the reader, all instance code will be listed below, you can put them in an HTML file, then preview the effect. HTML file download.

open

Save as
Print
Turn off this window All select
refresh Refresh View Source File
full screen display
Add to Favorites
Plug
Internet option Pro-1 Advance 2


New Post(0)