• Archives

  • Archive for the ‘Javascript’ Category

    Javascript comments

    Saturday, April 12th, 2008

    Comments are very useful things in writing scripts which are useful for others to edit

    Syntax: 

    <html>
    <body>
    script type=”text/javascript”>
    // Single line comment
     /* Multiline
           comment*/
    </script>
    </body>
    </html>

    Thanks

    krates

    Knowing your browser details through javascript

    Monday, April 7th, 2008

    Hey all sometimes you need to display someone browser details

    This can be easily done through javascript

    Syntax:

    <html>
    <body>
    <script type="text/javascript">
    var browser=navigator.appName;
    var b_version=navigator.appVersion;
    var version=parseFloat(b_version);
    document.write("Browser name: "+ browser);
    document.write("<br />");
    document.write("Browser version: "+ version);
    </script>
    </body>
    </html>

    Isn’t that easy

    Thanks
    krates

    Converting RSS to Javascript

    Friday, February 22nd, 2008

    Well now there are online services to help you convert RSS feeds to Javascript.

    Just go here

    http://www.rss-to-javascript.com/

    Select RSS/RDF CONVERTER

    Enter the details click on preview to preview the newly created script or

    Click on “Generate” to generate the code

    Thanks

    krates

    Taking out the area of circle,rectangle,sphere and triangle

    Saturday, February 2nd, 2008

    Sometimes you want to take out the area of circle,rectangle,sphere and triangle

    Here i will tell you how

     Circle

    function areaOfCircle(radius) { return Math.PI * Math.pow(radius, 2); }

    Rectangle 

    function areaOfRectangle(width, height) { return width * height; }

    Sphere

    function areaOfSphere(radius) { return 4 * Math.PI * (Math.pow(radius, 2)); }

    Triangle 

    function areaOfTriangle(baseWidth, height) { return baseWidth * height / 2; }

    Thanks

    krates

    Creating a bookmark us link

    Thursday, January 24th, 2008

    The below script will tell you how to create a bookmark us link

    Syntax:

    function bookmarksite(title, url){
    
     if(checkIt('msie'))
    
     {
    
     	window.external.AddFavorite(url, title);
    
     }
    
     else if(checkIt('firefox'))
    
     {
    
     	alert('Press CTRL + D to bookmark this page.');
    
     }
    
     else if(checkIt('netscape'))
    
     {
    
     	alert('You need to press CTRL + D to bookmark our site.');
    
     }
    
     else if(checkIt('opera'))
    
     {
    
     	alert('You need to press CTRL + T to bookmark our site.');
    
     }
    
     else
    
     {
    
     	alert('You are using worthless browser');
    
     }
    
    }
    <a href="javascript:bookmarksite('Easytutorial.info -
    Web designing tutorials, 'http://www.easytutorial.info')"></a>

    For internet explorer it works fine and for mozilla firefox it will alerts

    please press CTRL + D to bookmark this site

    Else every thing work fine

    Thanks
    krates