你好,我已經創建了按鈕的表格式中的HTML表格標籤幫助下呈現請添加按鈕動態使用js.now我需要這些按鈕
function funchr()
{
\t $(".hr").remove();
\t
\t var btn = document.createElement("BUTTON");
var t = document.createTextNode("VIEW PROFILE");
btn.appendChild(t);
btn.setAttribute("id","viewid");
btn.setAttribute("class","vp");
document.body.appendChild(btn);
var btn = document.createElement("BUTTON");
var t = document.createTextNode("EMPLOYEE DIRECTORY");
btn.appendChild(t);
btn.setAttribute("id","empdir");
btn.setAttribute("class","ed");
document.body.appendChild(btn);
var btn = document.createElement("BUTTON");
var t = document.createTextNode("CREATE ABSENCE");
btn.appendChild(t);
btn.setAttribute("id","crabs");
btn.setAttribute("class","ca");
document.body.appendChild(btn);
}
<div class="hr">
<input type="button" id="hr" class="hrButton" value="HR" onclick="funchr();" />
<table id="hrtable"> </table>
你有什麼用?純JS還是jQuery? –
@TreeNguyen從代碼中不明顯嗎? –
@TomášZato我以爲只有jQuery的$(...) –