Problem with window.open

Discussion in 'JavaScript' started by akinak, Mar 20, 2008.

  1. #1
    Hey, Im a newbie with javascript. Iam trying to create a pop-up window linking from my current page. My problem is that instead of a pop-up window,it opens a full screen window.Here is the code. Plz help

    <head><script language="javascript" type="text/javascript"> </script></head>
    <body>
    <table border ="0" width="100%">
     <tr><th>Course ID</th>
    <th> Course Name</th>
    <th>Units</th>
    </tr>
    <tr>
    <td align="center"><a href="BUS101.html" onClick="JavaScript:window.open ('BUS101.html',height='300',width='400');return false;">BUS 101</a></td><td>Business Foundations and Analysis</td><td align="center">4.5</td></tr>
    </table>
    </body>
    Code (markup):

     
    akinak, Mar 20, 2008 IP
  2. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The window.open method takes three parameters. The first is the URL, the second is the name to assign to the window (which you can use as a target in other links), and the third is a comma-delimited list of options. You need to combine the height and width values into a single string and use that as the third parameter, such as:

    
    <a href="BUS101.html" onclick="window.open('BUS101.html', '', 'height=300,width=400'); return false;">BUS 101</a>
    
    Code (markup):
     
    vpguy, Mar 20, 2008 IP
  3. akinak

    akinak Peon

    Messages:
    256
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot vpguy. It certainly worked :)
     
    akinak, Mar 20, 2008 IP