删除按钮而不编辑Flash文件

时间:2015-07-21 11:13:47

标签: javascript jquery html flash dom

我使用了DataTable javascript tool来导出网格,所以我得到了这个html生成的代码:

     <div class="DTTT_container">
        <a class="DTTT_button DTTT_button_copy" id="ToolTables_example_0" tabindex="0" aria-controls="example"><span>Copy</span><div style="position: absolute; left: 0px; top: 0px; width: 44px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_5" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="44" height="29" name="ZeroClipboard_TableToolsMovie_5" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&amp;width=44&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_csv" id="ToolTables_example_1" tabindex="0" aria-controls="example"><span>CSV</span><div style="position: absolute; left: 0px; top: 0px; width: 38px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_2" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="38" height="29" name="ZeroClipboard_TableToolsMovie_2" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&amp;width=38&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_xls" id="ToolTables_example_2" tabindex="0" aria-controls="example"><span>Excel</span><div style="position: absolute; left: 0px; top: 0px; width: 45px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_3" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="45" height="29" name="ZeroClipboard_TableToolsMovie_3" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&amp;width=45&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_pdf" id="ToolTables_example_3" tabindex="0" aria-controls="example"><span>PDF</span><div style="position: absolute; left: 0px; top: 0px; width: 39px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_4" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="39" height="29" name="ZeroClipboard_TableToolsMovie_4" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&amp;width=39&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_print" id="ToolTables_example_4" title="View print view" tabindex="0" aria-controls="example"><span>Print</span></a>
    </div>

flash图片:

enter image description here

我想删除第一个按钮,所以我添加了这个脚本

$(".DTTT_button DTTT_button_copy").remove();

我得到了相同的图像!!!!所以:

  1. 这是什么原因?
  2. 如何在不编辑swf文件的情况下删除按钮?

2 个答案:

答案 0 :(得分:2)

您也可以使用CSS隐藏所需的元素:

.DTTT_button_copy, #ToolTables_example_0 
{
    display: none;
}

希望可以提供帮助。

答案 1 :(得分:1)

在加载页面后,页面中会添加数据表的内容

因此您的代码无法找到数据表按钮

$(document).ready(function(){
    setTimeout(function(){
      $(".DTTT_button DTTT_button_copy").remove();
    },100);
});

尝试将代码置于超时状态,该代码将在加载所有内容后生效