Chrome正在吃我的第一个< form> - 为什么? [英] Chrome is eating my first inner <form> -- why?

查看:99
本文介绍了Chrome正在吃我的第一个< form> - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢ASP.NET,我学习了< form> < form>内的标签标签。

 < form id =Superformaction =设置我认为是一个简单的DOM, javascript:return false;> 
< form id =Subform1action =javascript:return false;>
form1
< / form>
< form id =Subform2action =javascript:return false;>
form2
< / form>
< / form>

在这个例子中,IE8似乎正常工作,但Chrome(18.0.1025.142 beta-m)似乎使 Subform1 消失。有谁知道为什么?这是Chrome / webkit的错误吗?我做了一个jsFiddle来测试它 - 如果你有其他浏览器方便,我也很好奇这些结果。



试试 http://jsfiddle.net/weQmk/9/



在IE8我得到:

pre $ 表单我的浏览器看到:
Superform
Subform1
Subform2

但是在Chrome中:

 表单我的浏览器看到:
Superform
Subform2


解决方案

表单不能以这种方式嵌套。在关闭< / form> 标记时,第一个打开的表单被关闭。



这也是在这个小提琴中说明: http://jsfiddle.net/weQmk/11/


Thanks to ASP.NET I get to learn the intracacies of getting away with <form> tags inside <form> tags. I set up what I thought was a simple DOM that isn't working:

<form id="Superform" action="javascript: return false;">
<form id="Subform1" action="javascript: return false;">
    form1
</form>
<form id="Subform2" action="javascript: return false;">
    form2
</form>
</form>

In this example, IE8 seems to work normally, but Chrome (18.0.1025.142 beta-m) seems to make Subform1 disappear. Does anyone know why? Is this a Chrome/webkit bug? I made a jsFiddle to test it - if you have other browsers handy, I'm curious of those results too.

Try the example at http://jsfiddle.net/weQmk/9/.

In IE8 I get:

Forms my browser sees: 
Superform
Subform1
Subform2

But in Chrome:

Forms my browser sees:
Superform
Subform2

解决方案

Forms cannot be nested in that way. On encounter of the closing </form> tag, the first open form is closed.

This is also illustrated in this fiddle: http://jsfiddle.net/weQmk/11/

这篇关于Chrome正在吃我的第一个&lt; form&gt; - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆