JavaScript Basics
javascript to check opened window is closed or not
var win = window.open('http://www.yahoo.com');
alert(win.closed);
return boolean
javascript view webpages' HTML source
<input type="button" value="View" onclick="window.location = 'view-source:'+ 'http://www.royh.cn/'" />
Firefox only?
javascript get user selected text
IE version:
document.selection.createRange().duplicate().text;
Firefox version:
document.getSelection();
For all browser selected():
<input type="button" onclick="alert(selected())" />
<script type="text/javascript">
function selected(){
if (document.selection) return document.selection.createRange().duplicate().text;
else return document.getSelection();
}
</script>
No comments:
Post a Comment