i have a very simple code which tries to open a popup window but it passes to ruin the whole html and other code.
the code is as follows:
<head>
<script type="text/javascript">
function write(){
/* var w = String(window.offsetWidth),
s = String(window.offsetHeight);*/
var s = window.open('', 'MsgWindow', '_blank');
};
</script>
</head>
<body>
<button onclick="write();" id="writeBtn">Write</button>
</body>
so simple but it dosent do anything!
i don't know what is the problem.
s
like s.document.write('sanmveg')
but that dosen't workedwhat is the problem?
Rename your function. document.write()
is being called instead of your function. Calling document.write()
with no parameters causes unexpected behavior like this.
function mywrite() {
var s = window.open('', 'MsgWindow');
};
<button onclick="mywrite();" id="writeBtn">Write</button>