ASP FAQs and Answers (9)

Source: Internet
Author: User
Answer | Question 1, the implementation of the Open command

[Format]:d Ocument.execcommand ("open")
[description] This and VB and other programming design in the WebBrowser control of the command somewhat similar, we can also be pondering.
[For example] add between <body></body>:
<a href= "#" Onclick=document.execcommand ("open") > Open </a>

2, the use of Notepad edit the implementation of the command

[Format]:location.replace ("View-source:" +location)
[Description] Open Notepad and display the source code for the page in Notepad.
[For example] add between <body></body>:
<a href= "#" Onclick=location.replace ("View-source:" +location) > Use Notepad edit </a>

3, Save as the implementation of the command

[Format]:d ocument.execcommand ("SaveAs")
[Description] Save the page to a different directory on this site!
[For example] add between <body></body>:
<a href= "#" Onclick=document.execcommand ("SaveAs") > Save As </a>

4, the implementation of the Print command

[Format]:d ocument.execcommand ("print")
[Description] Of course, you must install the printer!
[For example] add between <body></body>:
<a href= "#" Onclick=document.execcommand ("print") > Print </a>

5. The implementation of the close command

[Format]:window.close (); return false
[description] Closes this window.
[For example] add between <body></body>:
<a href= "#" Onclick=window.close (); return false) > close this window </a>


Implementation of commands in the "edit (E)" Menu

Implementation of the full selection command
[Format]:d ocument.execcommand ("SelectAll")
[description] will be the selection of the entire content of the page!
[For example] add between <body></body>:
<a href= "#" Onclick=document.execcommand ("SelectAll") > select All </a>

Implementation of commands in the View (V) menu

1, the implementation of the Refresh command

[Format]:location.reload () or history.go (0)
[Description] The browser opens this page again.
[For example] add between <body></body>:
<a href= "#" Onclick=location.reload () > Refresh </a>
or add: <a href= "#" Onclick=history.go (0) > Refresh </a>

2, the source File command implementation

[Format]:location.replace ("View-source:" +location)
[description] View the source code for the Web page.
[For example] add between <body></body>:
<a href= "#" Onclick=location.replace ("View-source:" +location) > View source Files </a>


3, Full screen display command implementation

[Format]:window.open (document.location, "url", "fullscreen")
[Description] This page is displayed in full screen.
[For example] add between <body></body>:
<a href= "#" Onclick=window.open (document.location, "url", "fullscreen") > Full-screen display </a>


Implementation of commands in the "Favorites (A)" Menu

1. Add to the implementation of the Favorites folder command

[Format]:window.external.addfavorite (' url ', ' "Site name ')
[Description] Add this page to the Favorites folder.
[For example] add between <body></body>:
<a href= "Javascript:window.external.AddFavorite (' http://oh.jilinfarm.com ', ' Hu Ming's personal homepage ')" > Add to Favorites </a>

2. Organize the implementation of the collection folder command

[Format]:window.external.showbrowserui ("Organizefavorites", NULL)
[Description] Open the Organize Favorites dialog box.
[For example] add between <body></body>:
<a href= "#" Onclick=window.external.showbrowserui ("organizefavorites", NULL) > Organize Favorites </a>

Implementation of commands in the Tools (T) menu

Implementation of the 〖internet option command

[Format]:window.external.showbrowserui ("Privacysettings", NULL)
[Description] Open the Internet Options dialog box.
[For example] add between <body></body>:
<a href= "#" Onclick=window.external.showbrowserui ("privacysettings", null) >internet option </a>


Implementation of commands in the "toolbar"

1, the implementation of the forward command

[Format]history.go (1) or History.forward ()
[Description] The browser opens the next page.
[For example] add between <body></body>:
<a href= "#" Onclick=history.go (1) > Forward </a>
or add: <a href= "#" Onclick=history.forward () > Forward </a>

2, the implementation of the back command

[Format]:history.go (-1) or history.back ()
[description] The browser returns the previous browsed page.
[For example] add between <body></body>:
<a href= "#" Onclick=history.go ( -1) > Back </a>
or add: <a href= "#" Onclick=history.back () > Back </a>

3, the implementation of the Refresh command

[Format]:d ocument.reload () or history.go (0)
[Description] The browser opens this page again.
[For example] add between <body></body>:
<a href= "#" Onclick=location.reload () > Refresh </a>
or add: <a href= "#" Onclick=history.go (0) > Refresh </a>

VII. implementation of other orders

Implementation of the command to turn off this window periodically
[Format]:settimeout (Window.close (), closed time)
[description] Closes this window.
[For example] add between <body></body>:
<a href= "#" Onclick=settimeout (Window.close (), 3000) >3 seconds close this window </a>

If you also organize other use JavaScript to achieve the command, may wish to contribute to share with you.

"Attached" to facilitate the reader, the following will list all the instance code, you can put them in an HTML file, and then preview the effect. HTML file download.



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.