Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    window.open problem

    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>

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by mishigun View Post
    Code:
    	oWindow = window.open("","","toolbar=no,status=no,width=t1,height=t2,top=t3,left=t4");
    Code:
    	oWindow = window.open("","","toolbar=no,status=no,width="+t1+",height="+t2+",top="+t3+",left="+t4);

  • Users who have thanked Arty Effem for this post:

    mishigun (08-28-2008)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •