hi i have problem with my first addons.. i try to select the word on the website page with this function
function getSelected() {
var userSelection;
if (window.getSelection) {
userSelection = window.getSelection();
} else if (document.selection) {
userSelection = document.selection.createRange();
}
return userSelection;
}
function getText() {
var select = getSelected()+ "";
alert(select);
}
in my xul i execute the function above with this way :
<menuitem id="inlinetransContextMenuPage"
label="Terjemahkan dengan inlinetrans"
onclick="overlay.getText()" />
</popup>
but why i the word cannot appear when i select word on page (the pop up is blank)..