在HTML / Javascript页面中使用/不使用表单的输入字段是否有任何危险? [英] Is there any danger to using input fields outside/without forms in HTML/Javascript pages?

查看:187
本文介绍了在HTML / Javascript页面中使用/不使用表单的输入字段是否有任何危险?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入字段通常与表单相关联,但我想在简单的Javascript / HTML页面中使用它们。我不需要这个表格。我看到我的HTML页面没有问题,但有没有我不知道的危险或不好的做法?我只是不希望自己的网页出现问题。



(基本上,根据其他字段中的值,我的页面中的某个字段可以启用或禁用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屋!

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