Reputation: 1
I'm working with an activity with a WebView
embedded in it.
Now i want to display some content:
WebView mweb = new WebView(this);
mweb.getSettings().setJavaScriptEnabled(true);
setContentView(mweb);
......
mweb.loadData(tot, "text/html", "utf-8");
String tot
is the html text i like to render in the mweb, wich is composed of the div
tag with an 'ondblclick' event like this:
<script type="text/javascript">
var test = "false";
function changeHighlight(myElement) {
if(test == "false"){
document.getElementById(myElement).className = 'highlight';
test = "true";
}else{
document.getElementById(myElement).className = 'default';
test = "false";
}
}
</script>
<body>
<div id="center" ondblclick="javascript:changeHighlight('center');">Select here!!!</div>
</body>
How i can trigger this event with JavaScript inside the WebView to select div and to highlight it ? All is ok with 'onclick' event but not with 'ondblclick'.
Then how i can prompt the user to choose if the div
tag is selected or not?
Is it possible to insert a confirm dialog ?
Any suggestion will be appreciated. Sorry for my english.......thanks
Upvotes: 0
Views: 2616
Reputation: 1856
I know it's been a while since this question was asked, but have a look at this article. Hope this can still help you.
Upvotes: 1