Javascript设置隐藏的输入值在Firefox中不起作用 [英] Javascript set hidden input value does not work in Firefox

查看:60
本文介绍了Javascript设置隐藏的输入值在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一行javascript,它们都设置隐藏输入元素的值(name =''button''),然后提交表单。然后,帖子的目的地可以获取隐藏字段的值(request.form(button))并相应地处理。我用这个来检测点击了哪个按钮。这些按钮构建为链接,因为它们可以检测点击次数,因为我希望在网站的其他地方使用的下拉菜单具有一致的外观。这很容易实现并且在IE中完美地工作,但是在它提交的firefox中却没有,但是没有获取隐藏字段的值(即下面的登录)。任何人都可以帮助建议,使其在Firefox中工作,并节省我在非常大量的页面上单独编码提交按钮的任务。如果是这样,我将非常感激。这是代码:

I am using a line of javascript that both sets the value of a hidden input element (name=''button'') and then submits the form. The destination of the post can then pick up the value of the hidden field (request.form("button")) and process accordingly. I''m using this to detect which button has been clicked. The buttons are built as links because they can detect clicks and because I want a consistent appearance with drop down menus that I''ve used elsewhere in the site. This is simple to implement and works perfectly in IE but not in firefox where it submits but does not pick up the value of the hidden field (i.e. ''Login'' below). Can anybody help with a suggestion that will make it work in firefox and save me the task of coding submit buttons separately on a very large number of pages. If so, I would be extremely grateful. Here''s the code:

展开 | 选择 | Wrap | 行号

推荐答案

欢迎来到TheScripts。


不要在链接的href属性中使用括号。此外,定义一个函数,而不是直接将代码放入链接。

[HTML]< a class =''action''href =" javascript :submitForm( );"> [/ HTML]

和您的Javascript代码:
Welcome to TheScripts.

Don''t use brackets in the href attribute for your link. Also, define a function instead of putting code directly in your link.
[HTML]<a class=''action'' href="javascript: submitForm();">[/HTML]
and your Javascript code:
展开 | 选择 | Wrap | 行号



欢迎来到TheScripts。


不要在链接的href属性中使用括号。此外,定义一个函数,而不是直接将代码放入链接。

[HTML]< a class =''action''href =" javascript :submitForm( );"> [/ HTML]

和您的Javascript代码:
Welcome to TheScripts.

Don''t use brackets in the href attribute for your link. Also, define a function instead of putting code directly in your link.
[HTML]<a class=''action'' href="javascript: submitForm();">[/HTML]
and your Javascript code:
展开 | 选择 | Wrap | 行号


然后只需将Login值或任何值传递给submitForm函数:
Then just pass the ''Login'' value or whatever value you wish to the submitForm function:
展开 | 选择 | Wrap | 行号


这篇关于Javascript设置隐藏的输入值在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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