Thursday, December 16, 2010

JavaScript Basics

javascript to check opened window is closed or not

var win ='');

return boolean

javascript view webpages' HTML source

<input type="button" value="View" onclick="window.location = 'view-source:'+ ''" />
Firefox only?

javascript get user selected text

IE version:

Firefox version:

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();


1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Online Training from India. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    JavaScript Online Training from India