按钮在Chrome中不起作用 [英] Button doesn't work in Chrome

查看:333
本文介绍了按钮在Chrome中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

<button name="foo" value="bar" onclick="submit()" >foobar</button>

当我单击firefox中的按钮时,该值将被传输(为foo),并且我可以像下面这样读取该值:

When I click the button in firefox, the value is transferred (is foo) and I can read the value like the following:

dim mode                : mode                = lcase(request("foo"))  

但是当我在Chrome中执行相同的操作时,该值为空.

But the value is empty when I perform the same action in Chrome.

有人可以帮忙吗?

推荐答案

不同的浏览器具有不同的 default 按钮提交行为.如果您希望按钮提交表单(从而发布其名称和值对),则必须使用:

Different browsers have different default submit behaviors for buttons. If you want a button to submit the form (and thus post its name and value pair), you'll have to use:

<button type="submit" name="foo" value="bar" >foobar</button>

button type 属性可以是 submit button reset ,除非是明确指定的内容,会因浏览器而异.

The type attribute for button can be submit, button, or reset and unless this is explicitly specified, will vary from browser to browser.

这篇关于按钮在Chrome中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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