如何模拟对div的点击,然后在webview中编程的触发onclick事件? [英] How do I emulate a click on a div then fire the onclick event in webview programatically?

查看:1849
本文介绍了如何模拟对div的点击,然后在webview中编程的触发onclick事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JavaScript的新手,刚刚创建了一个可视应用程序与webView嵌入显示gmail iphone网站。我想做的是在这里是做一个计时器方法,然后在计时器方法,模拟点击刷新按钮来启动点击事件?
请帮助。



解决方案

Dom事件只需调用即可触发:



下面的代码将触发id为'#foo'的元素的点击事件

  document.getElementByTagName('foo' )。点击时(); 


I am new to JavaScript,just created a cocoa app with a webView embedded which display the gmail iPhone site.What i want to do here is to schedule a timer method, then in the timer method,emulate a click on a refresh button to fire the on click event? Please help.

解决方案

Dom events can be fired just calling it:

The code below will fire the click event of the element with the id '#foo'

document.getElementByTagName('foo').onclick();

这篇关于如何模拟对div的点击,然后在webview中编程的触发onclick事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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