Thursday, October 8, 2015

How to print a div

You can print any div by using this code. Just copy and pest this code in your html page what I given below:
<html>
<head> 
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> 
<!-- You should use JavaScript--> 
<script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($(elem).html());
    }

    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>my div</title>');
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        mywindow.document.write('</head><body >');
        mywindow.document.write(data);
        mywindow.document.write('</body></html>');

        mywindow.document.close(); // necessary for IE >= 10
        mywindow.focus(); // necessary for IE >= 10

        mywindow.print();
        mywindow.close();

        return true;}
</script>
</head>
<body>
<div id="mydiv"> <!-- This is the div what you want to print -->
    Hello world. I want to printed by your pronter. So print me now. 
Hello world. I want to printed by your pronter. So print me now. 
Hello world. I want to printed by your pronter. So print me now. 
   </div>
<div>
    This will not be printed.
</div>
<div id="anotherdiv">
    Nor will this.
</div>
<input type="button" value="Print Div" onclick="PrintElem('#mydiv')" />

</body>
</html>
 
Just try your self. Thank you 

Thursday, October 1, 2015

HTML-5

You can write HTML code in word pad, notepad, notepad++, DW etc. But I like to use Notepad++.
At first you have to take a new page in HTML format (index.html), I mean file's extension will be ".html". Now open it with notepad++.
HTML opening tag is <html> and closing tag is </html>. All code will be written between the middle <html> and </html>. For HTML, your main format:

<html>
<head>
    <title>.....</title> </head>
    <body>
        .......
    </body>
</html>



And in HTML5, your code format:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
   
</body>
</html>



Website by HTML5

You can write HTML code in word pad, notepad, notepad++, DW etc. But I like to use Notepad++.
At first you have to take a new page in HTML format (index.html), I mean file's extension will be ".html". Now open it with notepad++.
HTML opening tag is <html> and closing tag is </html>. All code will be written between the middle <html> and </html>. For HTML, your main format:

<html>
<head>
    <title>.....</title> </head>
    <body>
        .......
    </body>
</html>



And in HTML5, your code format:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
   
</body>
</html>



How to write html code?

You can write HTML code in word pad, notepad, notepad++, DW etc. But I like to use Notepad++.
At first you have to take a new page in HTML format (index.html), I mean file's extension will be ".html". Now open it with notepad++.
HTML opening tag is <html> and closing tag is </html>. All code will be written between the middle <html> and </html>. For HTML, your main format:

<html>
<head>
    <title>.....</title> </head>
    <body>
        .......
    </body>
</html>



And in HTML5, your code format:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
   
</body>
</html>