- according to the node.js authoritative guide, type the code and introduce the ejs template code
- part of ejs code
<script type="text/javascript" src="../node_modules/ejs/lib/ejs.js"></script>
<script>
function window_onload() {
<% if (errMsg) { %>
document.getElementById("msg").innerHTML = "<%=errMsg%>";
<%} else if (successMsg) {%>
document.getElementById("msg").innerHTML = "<%=successMsg>";
<%} else {%>
document.getElementById("msg").innerHTML = "";
<%} if (code == "") {%>
document.getElementById("tbxDate").value = new Date().toJSON.slice(0, 10);
<%} else {%>
document.getElementById("tbxCode").value = "<%=order.code%>";
document.getElementById("tbxDate").value = "<%=order.date.toJSON().slice(0,10)%>";
document.getElementById("tbxGoodsCode").value = "<%=order.goodsCode%>";
document.getElementById("tbxBrandName").value = "<%=order.brandName%>";
document.getElementById("tbxNum").value = "<%=order.num%>";
document.getElementById("tbxPrice").value = "<%=order.price%>";
document.getElementById("tbxMoney").value = "<%=order.num*order.price%>";
document.getElementById("tbxPersonName").value = "<%=order.personName%>";
document.getElementById("tbxEmail").value = "<%=order.email%>";
<%if (!errMsg) {%>
document.getElementById("tbxCode").setAttribute("readonly", true);
<%}%>
<%}%>
}
3. Compiler reports an error
4.
<script type="text/javascript" src="../node_modules/ejs/lib/ejs.js"></script>
5.