如何使用程序单击按钮 [英] how to click a button using program

查看:52
本文介绍了如何使用程序单击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想使用程序单击一个按钮.
意思是:我的页面上有一个按钮,我想使用代码单击该按钮.

请提出


谢谢.

Hi all

I want to click a button using program.
means:i have a button on my page and i want to click that button using code.

Please suggest


Thanks.

推荐答案

请参阅我对问题的评论.

这个想法是:您不能,也不想单击"按钮.对于.NET事件,您甚至无法在定义该事件的类或结构之外的任何地方触发任何事件.并且在JavaScript中这更容易,但这仍然不是一个点击.

在所有这些情况下,您都需要简单得多的事情:要产生相同的点击效果.您只需要定义一些可以在两个或多个位置调用的函数:一个位置将是来自Clickonclick事件处理程序的调用,该调用应是唯一的语句(或几乎是这样),并且,出于仿真目的,请从其他位置调用相同的函数.就这样.

由于您没有与我们分享您想要在按钮的哪一侧和何处声明什么,因此您可以使用纯客户端级JavaScript或Ajax自行解决问题,但是想法是相同的.

—SA
Please see my comment to the question.

The idea is: you cannot and you do not want to "click" a button. For a .NET event, you cannot even fire any event, anywhere except the class or a structure where this event is defined; and in JavaScript this is easier, but this is still not a click.

In all those cases, you need much more simple thing: to cause the same effect the click could do. You simply need to define some function which you can call in two or more places: one place would be a call from the Click or onclick event handler, where this call should be the only statement (or almost so), and, for simulation purpose, call the same function from elsewhere. That''s it.

As you did not share with us what do you want to happen on which side and where the button is declared, solve your problems with pure client-level JavaScript or with Ajax by yourself, but the idea would be the same.

—SA


这篇关于如何使用程序单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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