YUI 复选框按钮 - 检索选中的值

发布于 2024-07-11 18:29:24 字数 563 浏览 2 评论 0原文

(我尝试将其发布到 YUI 消息组上,但没有任何运气)

谁能告诉我如何检索 yui 按钮的选中状态? 我尝试在代码中创建按钮,然后将其输出为 HTML 按钮,但这只会更改标题属性。

当我使用复选框时,没有任何复选框被选中(当使用 jQuery 迭代它们时)。

有更简单的方法吗? 是说使用 3.0 Node API 还是 Element?

编辑: 为了澄清这个问题是如何产生的,我使用了 YUI ASP.NET 控件。 他们向页面添加控件,如下所示

Sys.Application.add_init(function() {    $create(YUIAspNet.Button, {"ButtonID":"yuiMyButton_btn","ButtonName":"yuiMyButton$btn","TabIndex":0,"ButtonType":"checkbox","Text":"Technology"}, null, null, $get("yuiMyButton"));});

因此,如您所见,查找所有按钮并不像我希望的那么简单。

(I've tried posting this on YUI message group but without any luck)

Can anyone tell me how to retrieve the checked state of a yui Button? I've tried by creating the Button in code, which is then outputted as a HTML button but this only changes the title attribute.

When I use checkboxes instead, none of the checkboxes are checked (when iterating through them with jQuery).

Is there an easier way of doing it? Say with the 3.0 Node API, or Element?

EDIT:
To clarify how this problem came about, I'm using the YUI ASP.NET controls. They add controls to the page like this

Sys.Application.add_init(function() {    $create(YUIAspNet.Button, {"ButtonID":"yuiMyButton_btn","ButtonName":"yuiMyButton$btn","TabIndex":0,"ButtonType":"checkbox","Text":"Technology"}, null, null, $get("yuiMyButton"));});

So as you can see, finding all buttons is not as simple as I'd like it to have been.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

那一片橙海, 2024-07-18 18:29:25

抱歉,您是在谈论复选框按钮吗? 使用:

myButton.get("checked")

其中 myButton 是 YAHOO.widget.Button 的实例。

Sorry are you talking about checkbox buttons? Use:

myButton.get("checked")

where myButton is an instance of YAHOO.widget.Button.

回心转意 2024-07-18 18:29:25

Chris,我是 YUI ASP.NET 项目的启动者。 我经常查看 YUI 邮件列表,我一定错过了你的问题。

我为您和其他遇到问题并最终阅读本文的人提供了一个更通用的答案,不仅针对复选框按钮,而且针对所有控件。

在客户端,您可以通过调用自定义包装客户端对象上的 .get_YUIControl() 方法来访问 YUI 对象,然后您可以控制原始 YUI 对象。 YUI 文档非常好,您可以找到有关您想要完成的任务的很好的描述。

Chris, I am the starter of YUI ASP.NET project. I watch the YUI mailing list regularly, I must of missed your question.

I have a more general answer for you and anyone else having the problem and ending up reading this, not just for checkbox button, but for all controls.

On the client, you can have access to the YUI object by calling the .get_YUIControl() method on the custom wrapper client object, then you have the control over the original YUI object. The YUI documentation is very good, and you can find a good description for what you'd like to accomplish.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文