在wordpress添加自制html頁面


一、如何把自己單獨做的HTML頁面放到基於 WordPress 的網站上?

方法一:

1、將 xx.html 修改為 page-xx.php 上傳到你當前使用的主題目錄中;
2、在WordPress后台創建別名為 xx 的頁面后發布,大功告成。

注意:創建的頁面別名一定要與page-后面一樣。或者在步驟1中將xx改為你的頁面ID。

二、添加”鋼材理論重量計算“頁面代碼:

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
</head>
<body>
<!-- 鋼材比重按7.85計算-->
<div class="text clearfix" style="text-align:center;">
    <span style="font-size:25px;color:black;" >鋼材理論重量計算</span><br><br></div><HR>
1、【方鋼】      輸入邊寬:<input type="text" id="a1" autocomplete="off" style="width:50px"/>毫米;
                  <input type="button" id="submit1" value="計算" style="margin: 0 auto;";/>
                  <input type="text" id="count1" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
2、【圓角方鋼】    輸入邊寬:<input type="text" id="a2" autocomplete="off" style="width:50px"/>毫米;
          輸入圓角半徑:<input type="text" id="r2" autocomplete="off" style="width:50px"/>毫米;
                      <input type="button" id="submit2" value="計算" />
                      <input type="text" id="count2" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
3、【鋼板、扁鋼、鋼帶】輸入寬度:<input type="text" id="a3" autocomplete="off" style="width:50px"/>毫米;
                      輸入厚度<input type="text" id="h3" autocomplete="off" style="width:50px"/>毫米;
                             <input type="button" id="submit3" value="計算" />
                             <input type="text" id="count3" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
4、【圓角扁鋼】    輸入寬度:<input type="text" id="a4" autocomplete="off" style="width:50px"/>毫米;
          輸入圓角半徑:<input type="text" id="r4" autocomplete="off" style="width:50px"/>毫米;
              輸入厚度<input type="text" id="h4" autocomplete="off" style="width:50px"/>毫米;
                     <input type="button" id="submit4" value="計算" />
                     <input type="text" id="count4" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
5、【鋼管】      輸入外徑:<input type="text" id="a5" autocomplete="off" style="width:50px"/>毫米;
          輸入壁厚:<input type="text" id="b5" autocomplete="off" style="width:50px"/>毫米;
                  <input type="button" id="submit5" value="計算" />
                  <input type="text" id="count5" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
6、【等邊角鋼】    輸入邊厚:<input type="text" id="a6" autocomplete="off" style="width:50px"/>毫米;
              輸入邊寬:<input type="text" id="b6" autocomplete="off" style="width:50px"/>毫米;
              輸入內面圓角半徑:<input type="text" id="r6" autocomplete="off" style="width:50px"/>毫米;
              輸入端邊圓角半徑:<input type="text" id="R6" autocomplete="off" style="width:50px"/>毫米;
                      <input type="button" id="submit6" value="計算" />
                      <input type="text" id="count6" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
7、【不等邊角鋼】   輸入邊厚:<input type="text" id="a7" autocomplete="off" style="width:50px"/>毫米;
              輸入長邊寬:<input type="text" id="b7" autocomplete="off" style="width:50px"/>毫米;
              輸入短邊寬:<input type="text" id="c7" autocomplete="off" style="width:50px"/>毫米;<br><br>            
              輸入內面圓角半徑:<input type="text" id="r7" autocomplete="off" style="width:50px"/>毫米;
              輸入端邊圓角半徑:<input type="text" id="R7" autocomplete="off" style="width:50px"/>毫米;
                      <input type="button" id="submit7" value="計算" />
                      <input type="text" id="count7" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
8、【工字鋼】     輸入高度:<input type="text" id="h8" autocomplete="off" style="width:50px"/>毫米;
              輸入腿寬:<input type="text" id="b8" autocomplete="off" style="width:50px"/>毫米;
              輸入腰厚:<input type="text" id="d8" autocomplete="off" style="width:50px"/>毫米;
              輸入平均腿厚:<input type="text" id="t8" autocomplete="off" style="width:50px"/>毫米;  <br><br>                       
              輸入內面圓角半徑:<input type="text" id="r8" autocomplete="off" style="width:50px"/>毫米;
              輸入端邊圓角半徑:<input type="text" id="R8" autocomplete="off" style="width:50px"/>毫米;
                      <input type="button" id="submit8" value="計算" />
                      <input type="text" id="count8" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
9、【槽鋼】      輸入高度:<input type="text" id="h9" autocomplete="off" style="width:50px"/>毫米;
              輸入腿寬:<input type="text" id="b9" autocomplete="off" style="width:50px"/>毫米;
              輸入腰厚:<input type="text" id="d9" autocomplete="off" style="width:50px"/>毫米;
              輸入平均腿厚:<input type="text" id="t9" autocomplete="off" style="width:50px"/>毫米;  <br><br>                       
              輸入內面圓角半徑:<input type="text" id="r9" autocomplete="off" style="width:50px"/>毫米;
              輸入端邊圓角半徑:<input type="text" id="R9" autocomplete="off" style="width:50px"/>毫米;
                      <input type="button" id="submit9" value="計算" />
                      <input type="text" id="count9" autocomplete="off" style="width:50px"/>KG/M<br><br><HR>
<div class="text clearfix" style="text-align:center;">
    <span style="font-size:20px;color:black;" >鋼材比重默認按7.85計算。本頁設計與制作:<a href="http://www.architect.wang">architect.wang</a></span><br><br></div>                        
</body>
<script>
function js(id){ return document.getElementById(id) }
js("submit1").onclick = function(){
    var a = js("a1").value;
    js("count1").value = (a*a)*(7.85*0.001);
}
js("submit2").onclick = function(){
    var a = js("a2").value;
    var r = js("r2").value;
    js("count2").value = (a*a-0.8584*r*r)*(7.85*0.001);
}
js("submit3").onclick = function(){
    var a = js("a3").value;
    var h = js("h3").value;
    js("count3").value = (a*h)*(7.85*0.001);
}
js("submit4").onclick = function(){
    var a = js("a4").value;
    var h = js("h4").value;
    var r = js("r4").value;
    js("count4").value = (a*h-0.8485*r*r)*(7.85*0.001);
}
js("submit5").onclick = function(){
    var a = js("a5").value;
    var b = js("b5").value;
    js("count5").value = (3.1416*b*(a-b))*(7.85*0.001);
}
js("submit6").onclick = function(){
    var a = js("a6").value;
    var b = js("b6").value;
    var r = js("r6").value;
    var R = js("R6").value;
    js("count6").value = (a*(2*b-a)+0.2146*(r*r-R*R*2))*(7.85*0.001);
}
js("submit7").onclick = function(){
    var a = js("a7").value;
    var b = js("b7").value;
    var c = js("c7").value;
    var r = js("r7").value;
    var R = js("R7").value;
    js("count7").value = (a*(1*b+1*c-a)+0.2146*(r*r-R*R*2))*(7.85*0.001);
}
js("submit8").onclick = function(){
    var h = js("h8").value;
    var b = js("b8").value;
    var d = js("d8").value;
    var t = js("t8").value;
    var r = js("r8").value;    
    var R = js("R8").value;
    js("count8").value = (h*d*1+2*t*(b-d)+0.8584*(r*r-R*R))*(7.85*0.001);
}
js("submit9").onclick = function(){
    var h = js("h9").value;
    var b = js("b9").value;
    var d = js("d9").value;
    var t = js("t9").value;
    var r = js("r9").value;    
    var R = js("R9").value;
    js("count9").value = (h*d*1+2*t*(b-d)+0.4292*(r*r-R*R))*(7.85*0.001);
}
</script>
</html>

 

筆記:

1.<HR>是分格線

 

2、若有js("count2").value = (a+b-c); 此時需要寫成:
 js("count2").value = (a*1+b*1-c)

不然a+b就成了a&b.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM