zoukankan      html  css  js  c++  java
  • table插入标签form标记怪现象

    最近帮朋友处理问题,它无法提交表单,得到一些时间,我发现了一个奇怪的问题

    <table>
    <form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="text" name="t" />
    <input type="submit" value="post"/>
    <div id="add">add</div>
    </form>
    </table>
    
    <script>
    $("#add").live('click', function(){
    
    $("form").append('<input type="file" name="t2" />');
    });
    </script>

    注意。form标签是放在table标签里面的,input标签所有跑到table标签外面了

    打开chrome浏览器,审查元素,发现



    调试了下。改了下位置。form标签放在table标签外面

    <form action="upload.php" method="post" enctype="multipart/form-data">
    <table>
    <input type="text" name="t" />
    <input type="submit" value="post"/>
    <div id="add">add</div>
    </table>
    </form>
    
    
    <script>
    $("#add").live('click', function(){
    
    $("form").append('<input type="file" name="t2" />');
    });
    </script>
    再打开chrome,

    这样正常了。

    经測试,发现chrome和Firefox浏览器有这个问题,ie不是问题.

    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    shell script-条件语句、循环语句
    shell script-判断式
    shell script
    AngularJs(Part 11)--自定义Directive
    AngularJS中的DI
    javascript的DI
    一些奇怪的Javascript用法
    AngularJS(Part 10)--页面导航
    URL中#符号的作用
    AngularJs(Part 9)--AngularJS 表单
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4628658.html
Copyright © 2011-2022 走看看