0
我知道我们不能这样做,但我想知道是否有另一种方法做以下的事情对外网站:使用JavaScript在iframe或DIV
<iframe width="100%" frameborder="0" height="100%" src="http://google.com"></iframe>
<script>
$(function(){
$(document.body).bind('mouseup', function(e){
var selection;
if (window.getSelection) {
selection = window.getSelection();
} else if (document.selection) {
selection = document.selection.createRange();
}
selection.toString() !== '' && alert('"' + selection.toString() + '" was selected at ' + e.pageX + '/' + e.pageY);
});
});
</script>
所以我想要做的在iframe中的操作。例如,打开一个包含选定文本的弹出窗口。