function modal(data) {
this.data = data;
this.each(data.el, data.data);
}
modal.prototype.each = function (data, html) {
var sys = data.slice(0, 1);
var ele = data.slice(1, data.length);
idObj(ele, html, sys);
};
function idObj(id, html, sys) {
if (sys === "#") {
var dat = document.getElementById(id);
} else if (sys === ".") {
var dat = document.getElementsByClass(id)[0];
}
;
for (var i in html) {
var str = "{{" + i + "}}";
dat.innerHTML = dat.innerHTML.replace(str, html[i]);
}
};
new modal({
el: "#page_service_milestones_decoration_log",
data: {
time: "2017-05-03",
zuoze: "方涛",
}
})