2012-02-06 85 views

回答

0

为按钮添加单击事件:在WebView中

<button type="button" onclick="your_button.performClick();">Your Button</button> 

设置单击事件:

WebSettings ws = wv.getSettings(); 
ws.setJavaScriptEnabled(true); 
wv.addJavascriptInterface(new Object() { 
    public void performClick() { 
    // Your can start Activity here 
     Intent intent = new Intent(); 
     // set Activity which you want to start 
     // Set flags, actions and other parameters if required 
     this.cordova.startActivity(intent); 
    } 
}, "your_button");