SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2000
    Location
    Singapore
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can somebody tell me a way to open a link in a new window instead of the traditional way of opening it in the same browser. I would also like to know how to detemine the new window's width and length. A code to close it will also be great -

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know how to determine the new width (not sure)....but here's how the code would look for a link to open in a new window...

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;a href="http://www.sitepoint.com" target="TOP"&gt;SitePoint.com&lt;/a&gt;
    [/code]

    Hope this helps...


    ------------------
    Chris Bowyer
    MyCoding.com: Join our mailing list for launch notification!
    "I'm not an insomniac, I'm a web designer."

  3. #3
    SitePoint Wizard
    Join Date
    Sep 1999
    Posts
    1,390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know I have specified the height and width using a script found at http://javascripts.com/ but I am not sure which one.

    This will also work:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>&lt;a href="http://www.yoursite.com" target="_new"&gt;YourSite.com&lt;/a&gt;[/code]

    Good Luck!

    ------------------
    http://redrival.com/trcfreebies/
    Get more hits, for free!

  4. #4
    SitePoint Zealot Lars's Avatar
    Join Date
    Jun 2000
    Location
    Denmark
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's some simple coding.

    Scroll bars=yes, with scroll bars.
    Scroll bars=no, without scroll bars.

    Insert this into the body of your HTML document:

    &lt;SCRIPT LANGUAGE="JavaScript"&gt;

    &lt;!-- Begin
    function win() {
    msg=window.open("PAGE NAME HERE.HTML","","height=400,width=300,left=80,top=80, scrollbars=yes");
    }
    // End --&gt;
    &lt;/script&gt;

    Here's the link:
    &lt;a href="javascript:win()"&gt;PAGE NAME HERE&lt;/a&gt;

    Hope you can use this!


    ------------------
    www.123hyperlinks.com - Founder and owner
    Webmaster resources and
    freebies!
    Contact: Webmaster@123hyperlinks.com

  5. #5
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of JavaScript, you could use plain HTML:
    &lt;A href='http://www.provider.com/something' target='listen' onClick="window.open('','listen','width=480,height=280');"&gt;&lt;B&gt;Text&lt;/B&gt;&lt;/A&gt;

    ------------------
    Webmaster
    www.emudreams.web.com

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2000
    Location
    Ft. Worth, TX, USA
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgive me if I'm being a dunce, but shouldn't the target be "_blank"?

    ------------------
    Pat Burroughs
    Wheels-off Web Design
    The Wheels-Off Website

  7. #7
    SitePoint Member
    Join Date
    Jun 2000
    Location
    Brossard
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by Ironx87:
    Can somebody tell me a way to open a link in a new window instead of the traditional way of opening it in the same browser. I would also like to know how to detemine the new window's width and length. A code to close it will also be great -<HR></BLOCKQUOTE>

    I wrote a some very good tutorial about this that you may want to read. It's explaining how to create a new browser window dynamically using JavaScript. There is also an online Window generator. Check it out:
    http://www.visicommedia.com/community/



  8. #8
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by Pat Burroughs:
    Forgive me if I'm being a dunce, but shouldn't the target be "_blank"?
    <HR></BLOCKQUOTE>

    The target is 'listen' 'cause the window that is opened is called 'listen'. Easy, right?

    ------------------
    Webmaster
    www.emudreams.web.com

  9. #9
    SitePoint Guru CJ's Avatar
    Join Date
    Apr 2000
    Location
    Mechelen, Belgium, Europe
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't get it why you guys search it so far... and all those codes are not really totally right.

    At this url isthe right code:
    http://freesources.net/authoring/jav...popupclick.htm

    You get the instructions with it...

    Christophe



    ------------------
    http://freesources.net - the ultimate webmaster resources site

  10. #10
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just for the record..."_blank", "top", etc...they both work...there are others which also cause links to open in a new window...had the same problem on a post at TWF before...a bit of a dispute over which was "correct".



    ------------------
    Chris Bowyer
    MyCoding.com: Join our mailing list for launch notification!
    "I'm not an insomniac, I'm a web designer."

  11. #11
    SitePoint Member
    Join Date
    Jul 2000
    Location
    Houston, TX 77034
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was unable to try Lars script on the page I wanted new windows opened, as there are many different images with different sizes.

    As I am not a javascript coder, but a mere tweaker, I could not follow dtremblay's tutorial since it did not provide the whole entire code to show me where to place all the stuff he taught us.

    I did try out the page that Christophe posted and it did work, HOWEVER it caused the underlying main page to suddenly jump to the top, which is very undesirable.

    Elledan's code won out overall. I will be able to use it for each individual photo with different sizes. It did NOT do any fonky undesirable jumping either.

    Here's the example: &lt;a href="http://redrival.com/shreela/merry/disneypics3test.html"&gt;Javascript Window Examples&lt;/a&gt; All of the first set of photo's will open a new window with traditional html way, the entire browser opens. After that you will see 2 text links called Javascript Windows.......the first one is from Christophe's suggested site, and the 2nd one is from Elledan's script with a touch of tweaking. Press that first one to see what I mean with the jumping (IE5).

    Thanks for all the help,
    Shreela


Bookmarks

Posting Permissions

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