JS common menu

xiaoxiao2021-03-06  36

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, the implementation of the Open command [Format]: Document.execCommand ("Open") [OpeN] This is the command in the WebBrowser control in the programming design of VB Some similarities, everyone can think about this. [Example] Add: Open 2, "Using Notepad Editing Command [ Format]: location.replace ("View-source:" location) [Description] Opens the notepad, showing the source code for the web page in Notepad. [Example] Join between : Directors Editor 3, Some Some To the command 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] Add: Print 5, the Close command is implemented [Format]: Window.close (); Return False [Description] will turn off this window. [Example] Join between : Off This window

Second, [Edit (e)] The implementation of the command in the menu The implementation of the full selection command [Format]: Document.execCommand ("SELECTALL") [Description] Put the entire contents of the page! [Example] Join between : all select

Third, [View "Implementation of the command in the (V)] menu 1, the implementation of the refresh command [Format]: location.reload () or history.go (0) [Description] The browser re-open this page. [Example] Add: or join: Refresh 2, the implementation of the source file command [Format]: location.Replace ("View-source:" location) [Description] View the source code for the page. [Example] Add: View Source File 3, Full Screen Display 〗 Command Implementation [Format]: Window.open (Document.Location, "URL", "Fullscreen") [Description] full screen Displays this page. [Example] Join between : full screen Show Add to Favorites 2, implement the implementation of the Collection Column command [Format]: Window.external.ShowBrowSerui (" Organizefavorites ", NULL) [Description] opens the finishing Favorites dialog box. [Example] Join between : > Folding Favorites

5. Implementation of the command in the [T)] menu INTERNET Options Commands [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, Implementation of the Forward command [Format] History.go (1) or History.Forward () [Description] The browser opens the latter 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: Retrieving the Implementation of the Refresh〗 [Format]: Document.Reload () or History.go (0) [Description] The browser re-open this page. [Example] Add: or join: Refresh If you still finish other Use JavaScript commands to implement, may wish to contribute 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.

open

Save as
Print
Turn off this window All select
refresh Refresh View Source File
full screen display
Add to Favorites

3AnT option Advance 1 Advance 2


New Post(0)