var selection = window.getSelection().toString();
Get highlighted text in iframe
var iframe= document.getElementById('popupiframe');
if(iframe){
var idoc= iframe.contentDocument || iframe.contentWindow.document;
if(idoc){
var selectionInIframe = idoc.getSelection().toString();
}
}
var getUserSelection = function(){
Ti.API.info("getUserSelection@function.js");
var iframe= document.getElementById('popupiframe');
if(iframe){
var idoc= iframe.contentDocument || iframe.contentWindow.document;
if(idoc){
var selectionInIframe = idoc.getSelection().toString();
if(selectionInIframe && selectionInIframe!=''){
Ti.API.info("selection in iframe=#"+selectionInIframe+"#");
return selectionInIframe;
}
}
}
Ti.API.info("window="+window.getSelection().toString());
return window.getSelection().toString();
};
沒有留言:
張貼留言