javascript - Not able to print pop up dialog box -


i need print popup dialog box. have tried several times, whole window popup dialog box, need print dialog box.

i did find 1 solution print dialog box, not showing values entered in text box while printing.

please me code below or give references print div values values inside text box.

this code have written print pop dialog.

<script>     function printcontent()     {         var documentcontainer = document.getelementbyid('scorecard');         var windowobject = window.open("", "printwindow",         "width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");         windowobject.document.writeln('<!doctype html>');         windowobject.document.writeln('<html><head><title></title>');         var str = "<style type='text/css' media='all'>";         str = str + "mystyles { text-align: center; }";         str = str + "</style>";         windowobject.document.writeln(str);         windowobject.document.writeln('</head><body>');         windowobject.document.writeln(documentcontainer.innerhtml);         windowobject.document.writeln('</body></html>');         windowobject.document.close();         windowobject.focus();         windowobject.print();         windowobject.close();     } </script> 

popup modal

html

<!-- trigger/open modal --> <button id="mybtn">open modal</button>  <!-- modal --> <div id="mymodal" class="modal">    <!-- modal content -->   <div class="modal-content">     <span class="close">x</span>     <p>some text in modal..</p>   </div>  </div> 

css

/* modal (background) */ .modal {     display: none; /* hidden default */     position: fixed; /* stay in place */     z-index: 1; /* sit on top */     left: 0;     top: 0;     width: 100%; /* full width */     height: 100%; /* full height */     overflow: auto; /* enable scroll if needed */     background-color: rgb(0,0,0); /* fallback color */     background-color: rgba(0,0,0,0.4); /* black w/ opacity */ }  /* modal content/box */ .modal-content {     background-color: #fefefe;     margin: 15% auto; /* 15% top , centered */     padding: 20px;     border: 1px solid #888;     width: 80%; /* more or less, depending on screen size */ }  /* close button */ .close {     color: #aaa;     float: right;     font-size: 28px;     font-weight: bold; }  .close:hover, .close:focus {     color: black;     text-decoration: none;     cursor: pointer; } 

js

// modal var modal = document.getelementbyid('mymodal');  // button opens modal var btn = document.getelementbyid("mybtn");  // <span> element closes modal var span = document.getelementsbyclassname("close")[0];  // when user clicks on button, open modal  btn.onclick = function() {     modal.style.display = "block"; }  // when user clicks on <span> (x), close modal span.onclick = function() {     modal.style.display = "none"; }  // when user clicks anywhere outside of modal, close window.onclick = function(event) {     if (event.target == modal) {         modal.style.display = "none";     } } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -