HTML ကို ပြစ်ဒါကို

HTML တွင် HTML ပုံစံကို ပြစ်ဒါကို တုပ်ပြန်ပေးပါ

HTML

မျှော်လင့်သည့် HTML ကို .html ဖိုင်ထဲသို့ ကျတည်းသည့်အပြင်

content.html

<a href="howto_google_maps.asp">Google Maps</a><br>
<a href="howto_css_animate_buttons.asp">Animated Buttons</a><br>
<a href="howto_css_modals.asp">Modal Boxes</a><br>
<a href="howto_js_animate.asp">Animations</a><br>
<a href="howto_js_progressbar.asp">Progress Bars</a><br>
<a href="howto_css_dropdown.asp">Hover Dropdowns</a><br>
Click Dropdowns
Responsive Tables

包含 HTML

使用 w3-include-html 属性来包含 HTML:

နိုင်ငံ

添加 JavaScript

HTML 包含是由 JavaScript 完成的。

နိုင်ငံ

<script>
function includeHTML() {
  var z, i, elmnt, file, xhttp;
  /* 遍历所有HTML元素的集合:*/
  z = document.getElementsByTagName("*");
  for (i = 0; i < z.length; i++) {
    elmnt = z[i];
    /* 搜索具有特定属性的元素:*/
    file = elmnt.getAttribute("w3-include-html");
    if (file) {
      /* 使用属性值作为文件名发出 HTTP 请求:*/
      xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4) {
          if (this.status == 200) {elmnt.innerHTML = this.responseText;}
          if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
          /* 移除属性,并再次调用此函数:*/
          elmnt.removeAttribute("w3-include-html");
          includeHTML();
        }
      }
      xhttp.open("GET", file, true);
      xhttp.send();
      /* ပေါ်လုပ်ငန်း ထွက်ခွာသွားသည်:*/
      return;
    }
  }
}
</script>

စင်းချိန်တွင် အခြေခံစာကြိုး includeHTML():

နိုင်ငံ

<script>
includeHTML();
</script>

亲自试一试

အများပြား အပေါ်လုပ်ငန်း ပါဝင်စိုက်

သင် အကယ်၍ အများပြား အပေါ်လုပ်ငန်း ကို ပါဝင်စိုက်နိုင်သည်:

နိုင်ငံ

<div w3-include-html="h1.html"></div>

亲自试一试