Javascript Android和iPhone的JS链接标签上的触发点击事件

Javascript Android和iPhone的JS链接标签上的触发点击事件,javascript,android,iphone,extjs,sencha-touch-2,Javascript,Android,Iphone,Extjs,Sencha Touch 2,我正在使用senchatouch(JavaScript和ExtJS)开发移动web应用程序。我有一个链接标签(只是 我只需要使用普通的JavaScript和ExtJS来模拟点击这个链接。这个链接必须在新的窗口/选项卡中打开。/android WebView wv = (WebView) findViewById(R.id.webview); wv.getSettings().setJavaScriptEnabled(true); //javascript function bindIcons

我正在使用senchatouch(JavaScript和ExtJS)开发移动web应用程序。我有一个链接标签(只是

我只需要使用普通的JavaScriptExtJS来模拟点击这个链接。这个链接必须在新的窗口/选项卡中打开。

/android

WebView wv = (WebView) findViewById(R.id.webview);
wv.getSettings().setJavaScriptEnabled(true);
//javascript

function bindIcons() {

            jQuery("a.icons").bind('mouseover mouseout mousedown mouseup focus blur touchstart touchend', function (e){
              if (typeof console !== "undefined" ) console.log(e);
              if (e.type=='mouseover' || e.type=='focus') 
              {
                jQuery(e.currentTarget).toggleClass('over',true);
              }

              if (e.type=='mousedown' || e.type=='touchstart') 
              {
                jQuery(e.currentTarget).toggleClass('down',true);
              }

              if (e.type=='mouseout' || e.type=='mouseup' || e.type=='touchend' || e.type=='blur') 
              {
                jQuery(e.currentTarget).toggleClass('down',false);
                jQuery(e.currentTarget).toggleClass('over',false);
              }
            });

            if (isAndroid())
               jQuery("a.ifandroid").attr("href","javascript:ifAndroid();");
            else
               jQuery("a.ifandroid").toggleClass('ifandroid',false);

      }

HTMLEvents
对象与
document.createEvent()
一起使用,模拟单击链接

var link=document.getElementById('link\u to\u click'),
event=document.createEvent('HTMLEvents');
initEvent('click',true,true);
link.dispatchEvent(事件);

请详细描述您的问题。您使用的是Android设备上的哪个浏览器。哪个Android。在此处编写不起作用的代码。我无法使用jQuery。我只能使用纯JavaScript和ExtJS。这是事件绑定,但我需要事件触发(单击模拟).这是天才,多年来一直在寻找解决方案,干杯!:)
function bindIcons() {

            jQuery("a.icons").bind('mouseover mouseout mousedown mouseup focus blur touchstart touchend', function (e){
              if (typeof console !== "undefined" ) console.log(e);
              if (e.type=='mouseover' || e.type=='focus') 
              {
                jQuery(e.currentTarget).toggleClass('over',true);
              }

              if (e.type=='mousedown' || e.type=='touchstart') 
              {
                jQuery(e.currentTarget).toggleClass('down',true);
              }

              if (e.type=='mouseout' || e.type=='mouseup' || e.type=='touchend' || e.type=='blur') 
              {
                jQuery(e.currentTarget).toggleClass('down',false);
                jQuery(e.currentTarget).toggleClass('over',false);
              }
            });

            if (isAndroid())
               jQuery("a.ifandroid").attr("href","javascript:ifAndroid();");
            else
               jQuery("a.ifandroid").toggleClass('ifandroid',false);

      }