function btnAddRow() {
//行号是从0开始,最后一行是新增、删除、保存按钮行 故减去2
var rownum = $("#table1 tr").length - 2;
var chk = "<input type='checkbox' id='chk_" + rownum + "' name='chk_" + rownum + "'/>";
//无事件的文本框
var taskid = "<input type='text' id='taskid_" + rownum + "' name='taskid_" + rownum + "' width='75px'/>";
var task = "<input type='text' id='task_" + rownum + "' name='task_" + rownum + "' width='75px'/>";
var project = "<input type='text' id='project_" + rownum + "' name='project_" + rownum + "' width='75px'/>";
var date = "<input type='text' id='date_" + rownum + "' name='date_" + rownum + "' width='75px'/>";
var remark = "<input type='text' style='width:200px' id='remark_" + rownum + "' name='remark_" + rownum + "' width='75px'/>";
var tak =" "; //下拉框
var lb = "<select' id='lb_"+rownum+"' style='width:120px' ><option value='普通'>普通</option><option value='休假'>休假</option><option value='加班'>加班</option></select>";
var row = "<tr><td>" + chk + "</td><td>" + tak + "</td><td>" + lb + "</td><td>" + date + "</td><td>" + remark + "</td></tr>";
$(row).insertAfter($("#table1 tr:eq(" + rownum + ")"));
}
以上是添加一行的代码,请问在下拉框获取数据库的值。如何在上面var tak =" ";中拼写select
6 个解决方案
#1
大神呢,求解决方法啊!有没有什么好的办法啊,在线等啊
#2
#3
用ajax
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
#4
ni zhe shi shen me yi shi ?
#5
ajax没用过能把后面的参数说的明白点吗
#6
所有代码都在这里了,,我去,改一下就可以了啊,一般处理程序里面写个witch,case
switch (context.Request["typetag"])
{case"provincelist":
//..........
break;
}
switch (context.Request["typetag"])
{case"provincelist":
//..........
break;
}
#1
大神呢,求解决方法啊!有没有什么好的办法啊,在线等啊
#2
#3
用ajax
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
#4
ni zhe shi shen me yi shi ?
#5
用ajax
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
ajax没用过能把后面的参数说的明白点吗
#6
用ajax
case "provincelist":
carea_infoService cis = new carea_infoService();
List<carea_info> list = cis.Getinfo();
StringBuilder strcarea = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
strcarea.Append("<option value='" + list[i].id + "'>" + list[i].name + "</option>");
}
context.Response.Write(strcarea.ToString());
break;
//前端
$.get("AjaxHandler/RegisterHandler.ashx?typetag=provincelist" + "&pro=" + 0 + "&dateline=" + new Date().toTimeString(), function (res) {
tak ="<select' id='lb_"+rownum+"' style='width:120px' >"+res+"</select>"; //下拉框
});
ajax没用过能把后面的参数说的明白点吗
switch (context.Request["typetag"])
{case"provincelist":
//..........
break;
}