Thursday, September 11, 2014

Export HTML table values into PDF using jsPDF

Today i am going to explain how to export the html table data into pdf using jsPDF.jsPDF plugin is used to convert HTML to PDF.jsPDF is an open-source library for generating PDF files.



Tuesday, September 9, 2014

Export HTML table values into Excel using jQuery

Today i am going to explain how to export the html table data into excel using jQuery.


Live DemoDownload Script


We need jquery libraya nad plugin files to perform this action.Please copy and Paste below library file.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="jquery.btechco.excelexport.js"></script>
<script src="jquery.base64.js"></script>

Jquery function

<script>
            $(document).ready(function () {
                $("#btn").click(function () { //button Id
                    $("#Exporttbl").excelexport({ //table id
                        containerid: "Exporttbl"
                       , datatype: $datatype.Table
                    });
                });
            });
        </script>

HTML

<table id="Exporttbl" border="1" style="border-collapse: collapse;">
            <thead>
                <tr>
                    <th>Sno</th>
                    <th>Programming Languages</th>  
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>Java</td>
                </tr>
            </tbody>
        </table>
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Sunday, September 7, 2014

Snow Effect using jQuery

This is very useful script for web developers.In this i have used many methods like html(),Math.random(),remove(),appendTo(),css(),clone() etc.


Live DemoDownload Script


Please copy and Paste below library file.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>

Snow plugin

<script>
        (function($){
            $.fn.snow=function(options){
                var $flake=$('#snow').css({'position':'absolute','top':'-50px'}).html('&#10052;'),//Get element values using ID
                    documentHeight=$(document).height(),
                    documentWidth=$(document).width(),
                    defaults={minSize:2,maxSize:8,newOn:200,flakeColor:"#fff"}, //Snow size and color
                    options=$.extend({},defaults,options);
                var interval=setInterval(function(){
                    var startPositionLeft=Math.random()*documentWidth-100,
                    startOpacity=0.5+Math.random(),
                    sizeFlake=options.minSize+Math.random()*options.maxSize,endPositionTop=documentHeight-40,
                    endPositionLeft=startPositionLeft-100+Math.random()*400,durationFall=documentHeight*10+Math.random()*6000;
                    $flake.clone().appendTo('body').css({left:startPositionLeft,opacity:startOpacity,'font-size':sizeFlake,color:options.flakeColor}).animate({top:endPositionTop,left:endPositionLeft,opacity:0.2},durationFall,'linear',function(){$(this).remove()});},options.newOn);
                    };
        })(jQuery);
        </script>

Jquery function

<script>
    $(document).ready( function(){
            $.fn.snow();
    });
    </script>
to display snow effect to call the following HTML code with ID.

HTML

<div id="snow"></div>
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Friday, September 5, 2014

Some useful CSS and Javascript tips

Some useful CSS and Javascript tips



Use the following Css code for hide anchor link.

Hide tag link using CSS

<a href="http://www.google.com" class="first">Google</a>
        <style>.first{ pointer-events:none;}</style>

Using onmouseover and onmouseout, We can hide and show div content.Find the below code for example or click live demo button.

Show hide div using Javascript

<a onmouseover="document.getElementById('div_name').style.display='block';" onmouseout="document.getElementById('div_name').style.display='none';"
href="" onclick="return false;">
Show</a>
<br />

<div id="div_name" style="display:none;margin:15px 15px 0px 15px;padding:5px;border:1px solid #aaa;">
This is more information placed in our hidden div.
When you move your mouse off the link above this DIV area will
disappear.
</div>

Show hide div using CSS

<style type="text/css">
        .popup {position: fixed;visibility: hidden;border:1px solid #000; padding:5px;}
        a:hover + .popup {visibility: visible;}
        </style>
        <a href="#">Show Popup</a>
          <p class="popup">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>


Please share your comments and feedback.Thanks.Please subscribe my updates via email.

CSS3 Text Effects

CSS3 Text Effects




Shadow

<style>#txt{text-shadow: 0 6px 4px #85c226,-3px -5px 4px #fe2192, 3px -5px 4px #f7c200; }</style>

Double

<style>#txt{text-shadow:0px -10px 0 #fe2192;font-size:30px;}</style>

Blur

<style>#txt{color: transparent;text-shadow: 0 0 5px rgba(0,0,0,0.5);}</style>

Cloudy Text Effect

<style>#txt{text-shadow: 0px 0px 10px rgba(255,255,255,0.6), 0px 0px 30px rgba(255,255,255,0.4), 0px 0px 50px rgba(255,255,255,0.3), 0px 0px 180px rgba(255,255,255,0.3);color: rgba(255,255,255,0);font-size: 30px;background:#000;}</style>

Embossed Text Effect

<style>#txt{text-shadow: -1px -1px 1px #fff, 1px 1px 1px #000;color: #9c8468;opacity: 0.3;}</style>

City Lights Text Effect

<style>
        #txt{color: #fff;text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff2d95, 0 0 30px #ff2d95, 0 0 40px #ff2d95, 0 0 50px #ff2d95, 0 0 75px #ff2d95;letter-spacing: 5px;}</style>


Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Tuesday, September 2, 2014

Change background color on Hover and onClick using Javascript

This is an example of how to change the background color using the OnClick and Hover using javascript.



Javascript Function

<script language="JavaScript">
    function changebg(color){
        document.bgColor = color;
    }
</script>

Mouseover Change Bg Color

<p><a href="#" onMouseOver="javascript:changebg('#EB2525')">Mouseover <strong>Red</strong></a></p>

MouseClick Change Bg Color

<p><a href="#" onclick="javascript:changebg('#000099')">MouseClick <strong>Blue</strong></a></p>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.