...

View Full Version : window.open problem



mishigun
08-27-2008, 07:42 PM
I have written the following code but i am not getting the values of t1,t2,t3 & t4 in window.open .... means i am unable to create a new window of users choice....please find out the bug... Thnxx

<html>
<head>
<title>Window Example</title>
</head>
<script language="javascript">
var oWindow=null;
function nwindow()
{
var t1=document.getElementById("txt1").value;
var t2=document.getElementById("txt2").value;
var t3=document.getElementById("txt3").value;
var t4=document.getElementById("txt4").value;
oWindow = window.open("","","toolbar=no,status=no,width=t1,height=t2,top=t3,left=t4");
if(oWindow != null)
{
var content="<html><head><title>New window</title></head>"
content += "<body>This window is opened on clicking of the <b>New Window</b> button</body></html>"
oWindow.document.write(content);
}
}

</script>

<body>
<form id="frmlab">
<table border="1" cellspacing="8" cellpadding="10" bordercolor="blue">
<th colspan="4"><font size="4" face="tahoma">Create a new window</font></th>
<tr><td colspan="4" align="center"><font face="tahoma"><b>Window Size</font></b></td></tr>

<tr>
<td><b>Width:</b></td>
<td><input type="text" id="txt1" name="txt1" size="6"></td>
<td><b>Height:</b></td>
<td><input type="text" id="txt2" name="txt2" size="6"></td>
</tr>

<tr>
<td colspan="4" align="center"><font face="tahoma"><b>Position</b></font></td>
</tr>

<tr>
<td><b>Left:</b></td>
<td><input type="text" id="txt3" name="txt3" size="6"></td>
<td><b>Top:</b></td>
<td><input type="text" id="txt4" name="txt4" size="6"></td>
</tr>

<tr>
<td colspan="3" align="center">
<input type="button" name="submit" value="New Window" onclick="nwindow()">
</td>
<td>
<input type="reset" name="reset" value="Reset">
</td>
</tr>

</table>

<td>
</tr>
</table>
</form>
</body>
</html>

Arty Effem
08-27-2008, 09:11 PM
oWindow = window.open("","","toolbar=no,status=no,width=t1,height=t2,top=t3,left=t4");


oWindow = window.open("","","toolbar=no,status=no,width="+t1+",height="+t2+",top="+t3+",left="+t4);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum