JavaScript 已禁用
我有一个选择下拉列表,其中有 4-5 个字段。一旦用户在下拉列表中选择一个值,我就必须为页面上的隐藏参数分配一个值。 (使用 javascript 函数 Onchange)。每当用户在同一页面上单击超链接 url 时,相同的隐藏参数就会传递到超链接 url。
当启用 javascript 时,这可以正常工作,但是当禁用 javascript 时该怎么办?我知道没有脚本标签,但我怎样才能实现上述功能?你能给我一些示例代码吗?
非常感谢,
i have a select dropdown list which has 4-5 fields. As soon as a user selects a value in the dropdown i have to assign a value to a hidden parameter on the page. (Using javascript function Onchange). The same hidden parameter is passed on to a hyperlink url whenever a user clicks on to it on a same page.
This works fine when javascript is enabled, but what to do when javascript is disabled ? i know there is noscript tag but how can i achieve above functionality ? can you give me some example code ?
Many Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您禁用了 JavaScript,则没有任何东西可以将其分配给隐藏字段。
如果 javascript 被禁用,您将必须能够处理将表单发布到服务器并在服务器端从表单中选定的项目中计算出来。
There is nothing that will assign it to a hidden field if you have javascript disabled.
If javascript is disabled you will have to be able to handle the form posting to the server and figuring out on the serverside from the selected item in the form.
当 javascript 被禁用时,javascript 就被禁用了。 Javascript 不存在。所以任何依赖 javascript 的解决方案都行不通。
如果您还想支持禁用 JavaScript 的用户,那么您在设计页面时必须考虑到这一点。
在您的情况下,您可能希望使用提交表单时提交的
When javascript is disabled, then, javascript is disabled. Javascript is not there. So any solutions relying on javascript being there will not work.
If you want to support javascript disabled users also, then you must design the page sconsidering that.
In your case, you might want to use the value of the
<option>
in the<select>
that is submitted when the form is submitted (no matter whether javascript is enabled or not)我的问题的解决方案是我创建了一个 url,然后使用 noscript 标记覆盖它。单击时,我调用了一个 javascript 函数,该函数再次覆盖了相同的函数。
因此,当启用 javascript 时,onclick 函数会将其发送到弹出窗口,而当禁用 javascript 时,noscript 标记将覆盖它并重定向到另一个页面。
The solution to my problem is that i created a url and then overwrite it using noscript tag. on click i was calling a javascript function which was again overwriting the same .
thus when javascript was enabled, onclick function was sending it to popup and when javascript was disabled the noscript tag was overwriting it and redirecting to a another page.