Implementing file link calls in a Web page

Source: Internet
Author: User
Links | Web page Hyperlinks are used in a large number of pages in the current Web page, using the 〈a href= "Specify files" to display text 〈/a〉. In addition, according to the different Web pages and the following several file links to call the way:

One, HTM end of the Web page

Relink a Web page using the window.location in JavaScript. In the following example one, when the browser calls this page, it is automatically linked to the/home/default.htm Web page.

〈html〉

〈head〉

〈title〉 Example One itle〉

〈/head〉

〈body〉

〈script language=javascript〉

〈!--

Window.location=″/home/default.htm″

--〉

〈/script〉

〈/body〉

〈/html〉

If you want to jump the page only, you need only the following lines in the page without additional HTML tags.

〈script language=javascript〉

〈!--

Window.location=″/home/default.htm″

--〉

〈/script〉

Second, ASP end of the Web page

ASP (Active Server Page) is a technology developed by Microsoft to dynamically generate Web pages in server segments, providing a great convenience for the design of Dynamic Web pages. To achieve the effect of example one, simply enter the following line in the ASP's Web page to achieve the goal.

〈%response.redirect″/home/default.htm″%〉

The execution of the above program is the same as the execution example one, but there are significant differences in how it is executed. In fact, for example one, the browser has applied two times page, the first time is the example one page, the second time is the/home/default.htm page. The ASP page only executes one application, and the server-side ASP.DLL program automatically moves the requested page to/home/default.htm and returns the page to the browser, so it is much more efficient.

The ASP page also provides a C-language-like inclusion file by inserting the 〈!--#include file= "/home/default.htm"--〉 code into any location on the Web page, as in the case of this code in a Web page:

〈html〉

〈head〉

〈title〉 example Three 〈/title〉

〈/head〉

〈body〉

〈p〉 prepare to call the file 〈/p〉

〈!--#include file=″home/default.htm″--〉

〈p〉 File Call End 〈p〉

〈/body〉

〈/html〉


When the server receives the page request, dynamically generates the return page, the content is replaces the 〈!--#include file=″default.htm″--〉 position with the Default.htm page, has formed one page to nest another page the situation. Use this method to make design and maintenance easier when you have the same parts in multiple pages. The disadvantage is that the Default.htm Web page file can only be in the same directory or its subdirectories of the sample three pages.

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.