1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

New Window

Discussion in 'Software Development' started by CyBerAliEn, Dec 2, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. CyBerAliEn

    CyBerAliEn Thread Starter

    Joined:
    Nov 25, 2001
    Messages:
    1,209
    Hey,

    I've been messing with the following code (example)

    <a href="javascript:window.open ('PAGE.HTM', 'newwindow', config='height=200,width=200, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')"> LINK TEXT</a>

    (might need to view page source to see HTML code)

    but when I use that code to open a new window, it opens a page that says [Object] in the main window that the link was opened from. What can I do or what am I doing wrong, so that the original page on the main page stays, and only the new page/etc is opened in the new window? Please help ASAP!

    Thanks
     
  2. plejon

    plejon

    Joined:
    Jul 26, 2001
    Messages:
    671
    I used a function to accomplish this.

    First, create a javascript function to open the window. Then, call it in the onclick event of your href.

    < SCRIPT LANGUAGE="JavaScript">
    function openWin(){
    aWindow=window.open("http://www.yahoo.com","thewindow","width=640,height=450,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
    }
    < /SCRIPT>


    < A HREF="#" ONCLICK="openWin();">Yahoo</A>

    Good luck
     
  3. CyBerAliEn

    CyBerAliEn Thread Starter

    Joined:
    Nov 25, 2001
    Messages:
    1,209
    Hey,

    Thanks for the help. But what if I want more than just one window that opens to different files? Also, can they open images too?

    Thanks
     
  4. plejon

    plejon

    Joined:
    Jul 26, 2001
    Messages:
    671
    Sure, no problem.

    For the image, just specify it's path. E.g.

    aWindow=window.open("http://www.site.com/picture.gif","thewindow"," width=640, ...

    To open two windows, just add another line to the function. Make sure to specify a different window name !

    aWindow=window.open("http://www.yahoo.com","thewindow"," width=640, ...
    aWindow=window.open("http://www.google.com","<b>otherwindow</b>"," width=640, ...
     
  5. CyBerAliEn

    CyBerAliEn Thread Starter

    Joined:
    Nov 25, 2001
    Messages:
    1,209
    Hey,

    k, thx... I'll be checking it out pretty soon to see if it works.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/60427

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice