Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有几个 html 页面,它们都使用完全相同的 div。
我想在一个单独的文件中拥有这个相同的 div,这样每次我必须进行更改时,我就不必一遍又一遍地复制新版本。
我不知道从哪里开始以及正确的术语,但我仅限于 html 和 javascript。
如果你使用 jQuery,你可以像这样使用 ajax.load:
$( "#yourDivId" ).load( "yourfile.html" );
http://api.jquery.com/load/
搜索下划线模板以及如何使用它们。