Thursday 19 January 2012

print div control using javascript


<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<scripttype="text/javascript">
functionPrintDiv()
{
var divToPrint = document.getElementById('divToPrint');
var popupWin = window.open('', '_blank', 'width=300,height=300');
popupWin.document.open();
popupWin.document.write('' + divToPrint.innerHTML + '');
popupWin.document.close();
}
script>
head>
<body>
<divid="divToPrint">
<divstyle="width:200px;height:300px;background-color:teal;">
      Sunil gurjar harda
div>
div>
<div>
<inputtype="button"value="print"onclick="PrintDiv();"/>
div>
body>
html>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger