如何从我的文本框中获取值到html表格单元格?
问题描述:
<html>
<head>
<script>
function printPage(id) {
var html = "<html>";
html += document.getElementById(id).innerHTML;
html += "</html>";
var printWin = window.open('', '', 'left=0,top=0,width=700,height=700,toolbar=0,scrollbars=0,status =0');
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
</script>
</head>
<body>
<div id="block1" style="DISPLAY:none;">
<table border="1" width="85%;" height="60%><br" mode="hold" /><tr>
<th colspan="6"></th>
</tr>
<tr>
<th>Employee No.</th><th>& EMP_NO.text</th><th>Permission No.</th><th>111</th><th>Date</th><th>12-09-2014</th>
</tr>
<tr>
<th>Employee Name</th><th>1001</th><th>Grade</th><th>A</th>
</tr>
<tr>
<th>Category</th><th>1001</th><th>Designation</th><th>HR</th>
</tr>
<tr>
<th>Department</th><th>111</th><th> Sub Dept.</th><th>abc</th>
</tr>
<tr>
<th>SubDept-Section</th><th>lmn</th><th>Group/Activity</th><th>kkk</th>
</tr>
<tr>
<th>Remark</th><th>good</th>
</tr>
<tr>
<th>Exception Type</th><th>dd</th>
</tr>
<tr>
<th>Required Date</th><th>12/12/12</th><th></th><th></th>
</tr>
<tr>
<th>Late Type</th><th>drpdwn</th><th>Reorting Time</th><th>1111</th>
</tr>
<tr>
<th>From Time</th><th>1111</th><th>To Time</th><th>1212</th><th>Total Time</th><th>0101</th>
</tr>
<tr>
<th>Approved By</th><th>abvv</th><th>Status</th><th>none</th><th>Remark</th><th></th>
</tr>
</div>
<input type="button" value="Print Block 1" onclick="printPage('block1');"></input>
</body>
</html>
<asp:textbox id=EMP_NO runat="server" CssClass="TextBox_BorderWRO" size="39">
<asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" />
如何从我的EMP_NO文本框中获取值到
How can i get the value from my EMP_NO textbox to
答
var emp_no = document.getElementById("EMP_NO").value;
>
var txtVal =
(#EMP_NO)。val();
制作< th > id为
< th id = myTH >
("#EMP_NO").val(); Make an <th> with id <th id="myTH">