Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP或JQuery或CSS(在wordpress中)-在显示表数据时显示Div_Php_Jquery_Css_Wordpress - Fatal编程技术网

PHP或JQuery或CSS(在wordpress中)-在显示表数据时显示Div

PHP或JQuery或CSS(在wordpress中)-在显示表数据时显示Div,php,jquery,css,wordpress,Php,Jquery,Css,Wordpress,我正在wordpress网站上使用灵活的地图插件。该插件有一个表单,允许用户输入他们的“发件人地址”,以获得地图上显示位置的方向。表单没有ID或类(我无法添加ID或类) 我希望用户能够在表单提交后打印说明,但我不希望打印按钮在用户按下提交按钮显示说明之前显示出来 方向显示在一个表中,所以我想我可以使用JQuery来表示当显示表时,然后显示print div 我认为是这样的,但我不确定如何基于表格式化它(因为表单没有ID): 任何建议都将不胜感激 编辑以下是按下方向提交按钮后生成的代码: <

我正在wordpress网站上使用灵活的地图插件。该插件有一个表单,允许用户输入他们的“发件人地址”,以获得地图上显示位置的方向。表单没有ID或类(我无法添加ID或类)

我希望用户能够在表单提交后打印说明,但我不希望打印按钮在用户按下提交按钮显示说明之前显示出来

方向显示在一个表中,所以我想我可以使用JQuery来表示当显示表时,然后显示print div

我认为是这样的,但我不确定如何基于表格式化它(因为表单没有ID):

任何建议都将不胜感激

编辑以下是按下方向提交按钮后生成的代码:

<div id="my-dir-div" style="float: left; direction: ltr;">
<form>
<p>
<input type="text" name="from">
<input type="submit" value="Get Directions">
</p>
</form>
<div jstcache="0">
<div class="adp-warnbox" jsdisplay="warnings.length" jstcache="1" style="display: none;">
<div class="warnbox-c2" jstcache="0"></div>
<div class="warnbox-c1" jstcache="0"></div>
<div class="warnbox-content" jscontent="$this" jsselect="warnings" jstcache="5"></div>
<div class="warnbox-c1" jstcache="0"></div>
<div class="warnbox-c2" jstcache="0"></div>
</div>
<div jseval="setupPanelStep(this, $waypointIndex)" jsvalues="$waypointIndex:0;" jsselect="legs[0].start_address" jstcache="2">
<table id="adp-placemark" class="adp-placemark" jstcache="0">
<tbody jstcache="0">
<tr jstcache="0">
<td jstcache="0">
<img jsvalues=".src:markerIconPaths[$waypointIndex]" jstcache="14" src="http://maps.gstatic.com/mapfiles/markers2/icon_greenA.png">
</td>
<td class="adp-text" jscontent="$this" jstcache="12">211 South Elson Street, Kirksville, MO 63501, USA</td>
</tr>
</tbody>
</table>
</div>
<div jsvalues="$legIndex:$index;" jsselect="legs" jstcache="3" jsinstance="*0">
<div class="adp-legal" jscontent="copyrights" jstcache="4">Map data ©2013 Google</div>
</div>
</div>
<div id="print">
<input id="print" class="printbtn" type="button" value="Print Directions" onclick="return pop_print()">
<script type="text/javascript">
function pop_print(){
w=window.open(null, 'Print_Page', 'scrollbars=yes');
w.document.write(jQuery('div#my-dir-div').html());
w.document.close();
w.print();
}
</script>
</div>


美国密苏里州柯克斯维尔南埃尔森街211号,邮编63501 地图数据©2013谷歌 函数pop_print(){ w=窗口。打开(空,“打印页面”,“滚动条=是”); w、 write(jQuery('div#my dir div').html()); w、 document.close(); w、 打印(); }
我想你可以试试这个(只有当页面上有id
adp placemark
的表格时,才可以显示)

还是这个

$(function(){
    if($('#my-dir-div table#adp-placemark td.adp-text').length) $('#print').show();
});

我尝试了这两种方法,像jQuery(document)一样直接插入到页面中;但是两者都不起作用。实际上
$(function(){…})
jQuery(document).ready()
,所以请使用一个。如果($('my dir div table.'adp placemark').length)$('print').show(),您可以保留代码
就在您的
中的
函数pop_print(){…}
下。我从页面中删除了脚本,并像这样将其添加到函数pop_print中,但它不起作用。。也许我做错了什么。函数pop#u print(){if($($)(''my dir div table#adp placemark').length)$('#print').show();w=window.open(null,'print_Page','scrollbars=yes');w.document.write(jQuery('$target_element').html());w.document.close();w.print()}pop#print是一个插件,它在div下:'

函数pop#u print(){if($(“#my dir div table#adp placemark').length)$(“#print').show();w=window.open(null,'print#Page',scrollbars=yes');w.document.write(jQuery('div#my dir div').html());w.document.close();w.print())
$(function(){
    if($('#my-dir-div table#adp-placemark').length) $('#print').show();
});
$(function(){
    if($('#my-dir-div table#adp-placemark td.adp-text').length) $('#print').show();
});