HTML reuse is a rarely mentioned term. Today’s summary of this issue is as follows:
In old versions of browsers, HTML documents do not support nesting, and we need to be able to reuse HTML code. There are two main methods based on server-side and client-side implementation:
1. Server-side implementation
a. Use SSI, which is a common shtml file.
Include statements for b.asp, php, etc., template pages and user controls for asp.net.
2. Implement
on the client side a. Use javascript client script
a1. You can trigger a js method in the onload event of the html document. In this method Find a page element as a container and output a piece of html code in the container (you can define a string to store the html code snippet to be output, such as: var str="
hello world!
";) .