HTML提交按钮:不同的值/按钮文本? [英] HTML Submit-button: Different value / button-text?

查看:176
本文介绍了HTML提交按钮:不同的值/按钮文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 'add tag'创建一个HTML表单提交按钮,但是,网页是瑞典语,所以我想要有一个不同的按钮文本

也就是说,我想要一个像

的按钮



但我想让我的代码像

  if(request.getParameter(cmd).equals(add标签))
tags.addTag(/*...*/);

这可能吗?如果是这样,怎么做?

可能使用按钮元素。

 < button name =namevalue =valuetype =submit>Sök< / button> 

关于按钮的W3C页面


使用BUTTON元素函数创建的按钮就像使用INPUT元素创建的按钮一样,但它们提供更丰富的呈现可能性:BUTTON元素可能具有内容。



I'd like to create an HTML form submit button with the value 'add tag', however, the web page is in Swedish, so I'd like to have a different button text.

That is, I want to have a button like

but I want to have my code like

if (request.getParameter(cmd).equals("add tag"))
    tags.addTag( /*...*/ );

Is this possible? If so, how?

解决方案

It's possible using the button element.

<button name="name" value="value" type="submit">Sök</button>

From the W3C page on button:

Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content.

这篇关于HTML提交按钮:不同的值/按钮文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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