在HTML / Javascript页面中使用/不使用表单的输入字段是否有任何危险? [英] Is there any danger to using input fields outside/without forms in HTML/Javascript pages?
问题描述
(基本上,根据其他字段中的值,我的页面中的某个字段可以启用或禁用Javascript)
你应该没问题。无论如何,在HTML 4.01标准中都是可以的。
http://www.w3.org/TR/html401/interact/forms.html#form-controls
用于创建控件的元素通常出现在FORM
元素的内部,但当它们用于构建用户界面时,也可能出现在FORM元素声明
之外。这在内部事件的
部分进行了讨论。请注意,表单之外的控件不能
成功控制。
Input fields are usually associated to forms, but I would like to use them in a simple Javascript/HTML page. I don't need the form. I see no issue with my HTML page, but is there any danger or bad practice I am not aware of? I just don't want my page to bug down the road.
(Basically, a field in my page can be Javascript enabled or disabled according to values in other fields)
You should be fine AFAIK. It's ok in the HTML 4.01 standards anyway
http://www.w3.org/TR/html401/interact/forms.html#form-controls
The elements used to create controls generally appear inside a FORM element, but may also appear outside of a FORM element declaration when they are used to build user interfaces. This is discussed in the section on intrinsic events. Note that controls outside a form cannot be successful controls.
这篇关于在HTML / Javascript页面中使用/不使用表单的输入字段是否有任何危险?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!