In my code i wrote this code for popup
but the commented line
// mywindow.document.write('<html><head><title>my div</title>');
automatically executed.Why?
and if i deleted this line my page don’t show any error.
if it is present as comment it shows an error that duplicate title tag.
function Popup(data) {
var mywindow = window.open('', 'mydiv', '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();
mywindow.print();
return true;
}
If you executed it on the server and then commented it, the server might have cached your old js file… try to pass a parameter (any) to the js file in the tag:
<script src="myfile.js?version=1.0"/>