更新craeteElement,自動將建立的元件加入到parent。
===
var common = {};
common.createElement = function (tag, attributes, parent) {
var element = document.createElement(tag);
for (var attribute of attributes) {
element.setAttribute(attribute, attributes[attribute]);
}
if (parent !== undefined) {
parent.appendChild(element);
}
return element;
};
===.
2018年5月12日 星期六
[HTML] ribody
怕自己忘記,稍微紀錄一下。 各種各種理由(其中一個就是Vue,不能綁定在body上),導致時常需要一個包在body中的div,當作body來用,像這樣: === <body> <div id="divBody"> ...
-
自動腳本最好還是在網頁讀取完畢之後再執行,有些情況下甚至需要一個延遲時間。大致上如下。 === window.loadelay = 0; // 延遲時間 window.main = function () { // 程序內容 }; window.addEve...
-
let random = (start, end, base = 1) => { if (Array.isArray(start)) { return start[random(0, start.length - 1)]; } else...
-
在Node.js伺服器上要跟Microsoft的SQL Server連線需要套件mssql。 只談連線的話基本上是這樣做的。 === const mssql = require("mssql"); var dbConfig = { user: ...