前端页面重复信息处理方法——headerfooternavigation等

    xiaoxiao2021-12-14  20

    对于网页中的重复部分,例如:导航信息等单独放在一个网页中,然后其它页面调用。方便修改,提高工作效率,不需要每次都打开所有的页面。

    方法:将网页中重复部分写成单独的文件,根据使用的语言不同,选择不同的方式。例如:header.js,然后在当前页面的指定位置嵌入js脚本语句,调用生成的js脚本。

    1.asp语言

    index.asp

    <!–#include file=”header.asp”–>

    2.jsp语言

    index.jsp

    <%@ include file="header.jsp"%>

    3.js脚本语言

    index.html

    <script src="header.js"></script>

    header.js

    document.write('<!-- header --><div>...</div><!-- /header -->');

    转载请注明原文地址: https://ju.6miu.com/read-968367.html

    最新回复(0)