Rhodes-按下按钮时创建一个动作

发布于 2024-12-24 19:14:49 字数 95 浏览 7 评论 0原文

我想在按下屏幕上的按钮时增加变量的值,但我不知道该怎么做。 rhodes 中是否有类似 .click 或类似方法,以便当用户单击按钮时变量值应该递增?

I want to increment the value of a variable when a button is pressed on the screen, but I don't know how can I do that. Is there a method in rhodes like .click or something like that so that when the user clicks the button the variable value should be incremented?

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

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

发布评论

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

评论(1

丢了幸福的猪 2024-12-31 19:14:49

您是从头开始做这件事还是有一些代码可以显示以帮助我们了解您正在做的事情的整体概念?在本机 Jquery 中,我在下面的代码中提供了您的要求。据我了解,rhodes 配备了 Jquery,您应该能够使用它的本机控件。

HTML:

<div>
    <input type="button" id="button" value="Click Me" name="click_me" />
</div>

JQuery:

$(document).ready(function(){
    var clicks = 0;
    $("#button").click(function(){
        clicks++;
        alert(clicks);
    });
});

Fiddle:
http://jsfiddle.net/GvGoldmedal/KFax4/

Are you starting from scratch on this or do you have some code you can display to help us get a concept of what you're doing as a whole? In native Jquery what your asking I've provided in the code below. It's my understanding that rhodes comes equipped with Jquery and you should be able to use it's native controls.

HTML:

<div>
    <input type="button" id="button" value="Click Me" name="click_me" />
</div>

JQuery:

$(document).ready(function(){
    var clicks = 0;
    $("#button").click(function(){
        clicks++;
        alert(clicks);
    });
});

Fiddle:
http://jsfiddle.net/GvGoldmedal/KFax4/

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