JS dynamic Add table Data tr TD

Source: Internet
Author: User

Results Library Modifications:
Request a list of topics to change with the outcome type
Start on the web, add the change () event trigger DWR in the result type dropdown box, query theme collection--Create/Edit table dynamically
The summary code is as follows:

JSP page
[JavaScript]
Get Topic Data Dynamically
function Getzts () {
ParentID = document.getElementById ("Bselect1"). Value;
if (parentid!= "") {
Dwrmethod.getztlist (PARENTID,CALLBACK5);
}else{
Empty the data for the subject table
var T=document.getelementbyid ("Zhutitable"); Get table
var length= t.rows.length; Get the number of rows under table
if (length!=0) {//If there are lines, clear
for (Var i=length-1;i>=0;i--)
{
T.deleterow (i);
}
}
var r = T.insertrow ();
var c = R.insertcell ();
C.innerhtml= "no topic list";
document.getElementById (' zhutitable '). appendchild (t);
}
}
function Callback5 (provinces) {
var T=document.getelementbyid ("Zhutitable"); Get table
var length= t.rows.length; Get the number of rows under table
if (length!=0) {//If there are lines, clear
for (Var i=length-1;i>=0;i--)
{
T.deleterow (i);
}
}
if (provinces.length>0) {
for (var i = 0; i < provinces.length; i++) {
Tr
if (i%4==0) {
var r = T.insertrow (t.rows.length);//Create a new row
}
Td
var c = R.insertcell (); Create a new column
c.innerhtml = "<input type= ' checkbox ' name= ' zhutiids ' value=" +provinces[i][0]+ ">" +provinces[i][1 ";
}
}else{
var r = T.insertrow ();
var c = R.insertcell ();
C.innerhtml= "no topic list";
}
document.getElementById (' zhutitable '). appendchild (t);
}

[HTML]
<tr>
&LT;TD class= "Add_tit" > Achievement type </td>
<td>
<s:select id= "Bselect1" name= "PruType1" onchange= "Getzts ();" List= "Ptypelist" listkey= "id" listvalue= "productiontypename" headerkey= "" headervalue= "--Please select--"/>
<label class= "Note4" >*</label>
</td>
</tr>
[HTML]
<tr>
&LT;TD class= "Add_tit" > Themes </td>
&LT;TD id= "table1" style= "padding-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;" >
<table id= "zhutitable" border= "0" cellpadding= "0" cellspacing= "0" width=100% class= "table_table" >
<tr>
&LT;TD style= "color:red;" > Note: Please select the result type first </td>
</tr>
</table>
</td>
</tr>

---------------------------------------------------------------------------------------------I'm a split line----------------------- ------------------------------------------------------------------------------------

function Tbheartrates () {$.post (window.location.href, {"Action":"tbheartrates"}, Function (msg) {if(msg! ="") {alert ("1"); varobj = eval ("("+ msg +")"); varnum =obj.rows.length; //var aa = document.getElementById (' tbheartrates ');$('#tbheartrates'). Append ('<tr><th> test Date </th><th> test results </th><th> normal range </th> <th> unit </th ><th> Warm Tips </th><th></th><th></th><th></th><th></th ></tr>');  for(vari =0; i < num; i++) {                    varTROBJS = Document.createelement ("TR"); Trobjs.innerhtml='<td class= "Tdfirstline" >11 month 10th </td> <td class= "Tdsecondline" >'+ Obj.rows[i]. JSON_ECG +'</td> <td class= "Tdthreeline" >60-100</td> <td class= "Tdfourline" > Times/m</td> <TD class= "Tdfiveline" > Your heart rate is below normal range </td> <td class= "Tdsixline" ></td> <td class= "Tdsevenline" > </td> <td class= "Tdeightline" ></td> <td class= "Tdnineline" ></td>'; varTrobjimg = Document.createelement ("TR"); Trobjimg.innerhtml='<td colspan= "9" >'+ Obj.rows[i]. Json_ecgxy +'" style=" margin-left:-30px; "/></td>'; $('#tbheartrates'). Append (TROBJS); $('#tbheartrates'). Append (trobjimg);    }            }        }); }

JS dynamic Add table Data tr TD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.