$ j = 1; ?> var t =''; var options =「」;我如何追加或預先使用jquery這個動態行到表中
</script>
<?php
foreach ($this->data['DEFAULTS'] as $rec){
foreach ($rec as $key=>$val){
?>
<script type="text/javascript">
var cntr = "<?php echo $j;?>";
var reference_value = '<?php echo $val["GETVAL"];?>';
var sel = '<select name="code[]">'+options+'</select>';
var txt = '<input type="text" class="TextBox" name="referencevalue[]" valign="top" value="'+ reference_value +'">';
t += '<tr id ='+cntr+'><td>'+cntr+'</td><td valign="top">'+sel+'</td><td valign="top" ailgn="center">'+txt+'</td></tr>';
</script>
<?php
$j++;
}
}
?>
<script type="text/javascript">
alert("MYTABLE "+t);
$("#ref").append(t);
</script>
when i say alert(t) iam getting the entire table structure and the data but iam not able to add it to the table
.Here is the Table Structure where i have to add
<table width="100%" cellspacing="2" cellpadding="2" align="left">
<tbody><tr>
<th class="coltextleft">
<span style="font-size: 14px; font-weight: bold;" id="id_refTbl">
<img id="IMG1" height="15" width="15" align="middle" src="cllpsed.gif"/> </span>
</th>
</tr>
<tr><td>
<div id="ref" style="display:none">
<table id="ref" width="100%" class="formTable">
<tr>
<td> </td>
<td> Code</td>
<td> Value</td>
<td> </td>
</tr>
<tr><td>I need to add the result of alert(t) with inthis rows</td></tr></table>
感謝它解決了。所以我的問題是。我如何得到選擇從我的PHP函數返回的選項 var my_option_selected =「<?php echo json_encode(StuClass :: getopt($ val [」CDE「]] ,$ OPT));?>「; var sel =''; – Someone 2010-10-24 19:12:12
@Someone - 需要在你的'
我有兩行已經用於表格「ref」我必須在兩行之後添加動態行 – Someone 2010-10-24 19:45:57