我已经成功地完成了一件事情,但是我有两件事情正在进行我想从两个不同表的值中动态打印出来。这是我的代码:单击按钮时,它会转到另一个页面,该页面会打印出用户在文本字段中填写的内容。这是我的做法:
function print_list(item_names,number_of_items) {
var theText="<ol>";
for(var i=1; i<=number_of_items;i++){
if($("#" + item_names + "_" + i).val()!=''){
theText+="<li>"
theText+=$("#" + item_names + "_" + i).val();
theText+="</li>";
}
}
theText +="</ol>";
$("#print_content_area").html(theText);
Array.filter( document.getElementsByClassName('printArea_1'), function(elem){
$(".printing_list").printElement( elem );
});
}
我需要分开两个不同的字段这里是表
<div id="blue_small_header_text" align="left" style="padding-top:5px;"> What to
say and do <div id="list_buttons"><a class="print_list"
onclick="print_list2('activities_say',3);"></a><a class="list_help"
onclick="openDialog('list_help');"></a></div></div>
<div id="list_question_btn"></div></div>
<div id="activity_area_content" style="padding:5px">
<table width="100%" style="line-height:0px">
<tr>
<td><p style="width:50px;">To say</p></td>
<td><input class="printArea_1 activities_say1_box" name="activities_say_1"
id="activities_say_1" type="text" placeholder="Type or click the list
button >" style="width:340px;" /></td>
<td><input type="button" id="say_1" class="list_btn list_say" value="List >" /></td>
</tr>
<tr>
<td style="font-size:9px;"> To do</td>
<td align="center"><input class="printArea_1 activities_do_box" name="activities_do_1" id="activities_do_1" type="text" placeholder="Type or click the list button >" style="width:340px;" /></td>
<td><input type="button" id="do_1" class="list_btn list_do" value="List >" /></td>
</tr>
<tr>
<td><p style="width:50px;">To say</p></td>
<td><input class="printArea_1 activities_say1_box" name="activities_say_2" id="activities_say_2" type="text" placeholder="Type or click the list button >" style="width:340px;" /></td>
<td><input type="button" id="say_2" class="list_btn list_say" value="List >" /></td>
</tr>
<tr>
<td style="font-size:9px;"> To do</td>
<td align="center"><input class="printArea_1 activities_do_box" name="activities_do_2" id="activities_do_2" type="text" placeholder="Type or click the list button >" style="width:340px;" /></td>
<td><input type="button" id="do_2" class="list_btn list_do" value="List >" /></td>
</tr>
<tr>
<td><p style="width:50px;">To say</p></td>
<td><input class="printArea_1 activities_say1_box" name="activities_say_3" id="activities_say_3" type="text" placeholder="Type or click the list button >" style="width:340px;" /></td>
<td><input type="button" id="say_3" class="list_btn list_say" value="List >" /></td>
</tr>
<tr >
<td style="font-size:9px;"> To do</td>
<td align="center"><input class="printArea_1 activities_do_box" name="activities_do_3" id="activities_do_3" type="text" placeholder="Type or click the list button >" style="width:340px;" /></td>
<td><input type="button" id="do_3" class="list_btn list_do" value="List >" /></td>
</tr>
这是正在打印的页面。
<div class="printing_list" id="printList2" >
<img id="print_logo" src="/images/print_header_med.png">
<div align="left" id="printHead_text"></div>
<br />
<div align="left" class="listPrint_info" style="width:700px;"></div>
<br />
<table width="100%" style="line-height:20px; margin-left:10px;" >
<tr id="Say_list">
<td id="print_content_area2"></td>
</td>
</tr>
</table>
<table width="100%" style="line-height:20px; margin-left:10px;" >
<tr id="Say_do_list">
<td id="print_content_area2"></td>
</td>
</tr>
</table>
</div>