修复Firefox文件选择窗口从打开所有其他Windows后面

时间:2014-10-07 17:53:32

标签: javascript html css

我正在使用vBulletin,目前当有人使用FireFox点击“选择文件”上传附件时,文件窗口提示会在其计算机上的所有其他窗口后面打开。

这是我发现的代码,我认为这与调用窗口打开的函数有关:

<div id="asset_addfiles">
        <div id="selectall2"<vb:if condition="!$attachcount"> class="hidden"</vb:if>><label for="selectallbox2">{vb:rawphrase select_all} <input type="checkbox" id="selectallbox2" name="selectall2" value="1" tabindex="1" /></label></div>
        {vb:rawphrase selected_attachments} 
        <button type="button" id="insert_inline" class="button" title="{vb:rawphrase insert_attachments_in_window}">{vb:rawphrase insert_inline_x, 0}</button>      
        <button type="button" id="insert_attachment" class="button">{vb:rawphrase done}</button>
    </div>  

    <script type="text/javascript">
    <!--
        var assetobj = new vB_Asset("assetobj", "asset_category_tree", "{vb:raw posthash}", "{vb:raw poststarttime}", "{vb:raw contenttypeid}", "{vb:raw bbuserinfo.userid}", {vb:raw auth_type}, {vb:raw asset_enable}, "{vb:raw insertinline}");
        <vb:if condition="$show['updateparent']">
            if (typeof window.opener != 'undefined' && typeof window.opener.vB_Attachments != 'undefined')
            {
                window.opener.vB_Attachments.reset();
                {vb:raw new_attachlist_js}
            }
        </vb:if>

    //-->
    </script>
    <!-- This element is cloned via javascript since IE doesn't like one to alter file input -->
    <form action="">
    <input id="uploadinput" type="file" class="bginput uploadinput" name="attachment[]" size="30" style="display:none" tabindex="1" />
    </form>

非常感谢任何帮助。谢谢

1 个答案:

答案 0 :(得分:0)

向表单添加ID或CSS类,并在css中为其指定z-index。

<form id="uploadinputform" action="">

并且css将是:

#uploadinputform { z-index: 9; }

或者像这样做内联样式的黑客攻击:

<form style="z-index: 9;" action="">