Monday, January 7, 2013

div open in window.open using javascript


<script language="JavaScript" type="text/javascript">
<!--
function doWin(){
var orig_div_cont=document.getElementById("showcontent").innerHTML;
var myWin=window.open("","myWin","menubar,scrollbars,left=30px,top=40px,height=400px,width=600px");
myWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">'+
'<html><head><title>My Window</title></head><body><div id="dest_div">'+
'Some original division content. <br /></div></body></html>');
myWin.document.close();
myWin.document.getElementById("dest_div").innerHTML+=orig_div_cont;
}
//-->
</script>


<div id="showcontent">di content show in window pop</div>
<a href="javascript:;" onclick="doWin();">open</a>

No comments:

Post a Comment