为什么html复选框只传输一个“开”值? [英] Why do html checkboxes only transmit an 'on' value?

查看:189
本文介绍了为什么html复选框只传输一个“开”值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习互联网编程。

I'm just starting to learn internet programming.

在打勾之后,我发现了硬的方法,只有当复选框被选中

After playing around with checkboxes, I found out the hard way, that it is only when the checkbox is checked that it transmits an 'on' value.

推荐答案

为什么不发送关闭解决方案

解决方案

我认为这必须是为了简洁的传输。每个请求到服务器是发送通过电线,如果你有一个页面上有数千个复选框,你会发现,告诉服务器这个盒子是关闭的数据量实际上是相当大的作为如何发送每个复选框元素的名称 - 这可能会累积到兆字节的信息,这将减缓整个用户体验和互联网下降)。

I think it must be for brevity of transmission. Each request to the server is sent 'over the wire' if you've got a page with thousands of checkboxes on it, you will find that the amount of data to tell the server "this box is off" is actually quite sizeable (seeing as how you'd have to send the NAME of each checkbox element - that could add up to megabytes of information - which would slow the entire user experience & internet down).

但事实上你知道 是因为它没有被发送,所以没有必要发送。

Whereas in fact you know that it is off by virtue of it not being sent - so there's no need to send it.

这篇关于为什么html复选框只传输一个“开”值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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