SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast jrwap's Avatar
    Join Date
    Oct 2000
    Location
    NJ
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How can I edit this code so that the link comes up in a new window?

    code:

    function open_window(url) {
    var NEW_WIN = null;

    NEW_WIN = window.open ("","RecordViewer","toolbar=no,width="+<?php echo $new_window_width ?>+",height="+<?php echo $new_window_height ?>+",directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
    NEW_WIN.location.href = url;
    }


    Thanks,

    -JRW

  2. #2
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    I don't quite understand. That code should open a new window. Perhaps you want all new windows for all the calls to the function? If so, try:

    Code:
    function open_window(url) { 
    var NEW_WIN = null; 
    NEW_WIN = window.open (url,"","toolbar=no,width=<?php echo $new_window_width ?>,height=<?php echo $new_window_height ?>,directories=no,status=no,scrollbars=yes,resize=no,menubar=no"); 
    }
    I didn't quite understand the PHP code b/c it is a serverside language and would be parsed before the javascript, so I took out the +" things. I don't quite understand what you need.

    aDog

  3. #3
    SitePoint Enthusiast jrwap's Avatar
    Join Date
    Oct 2000
    Location
    NJ
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know too much PHP and even less JavaScript. This is the function that is called that allows users to go to another site. As the code stands now.... when the user click on the link the current window loads the url meaning that they have left my site. I would like the url to load in a different window so that they aren't forced to leave my site.

    Maybe this helps....


    -JRW

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Any reason you're not just using the following?

    <a href="..." target="_blank">...</a>
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Babys got backa hard back, that is: The Ultimate CSS Reference

  5. #5
    SitePoint Enthusiast jrwap's Avatar
    Join Date
    Oct 2000
    Location
    NJ
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Arielladog, I used your code word for word and still got the same results. I need to use function for this so that it is called when url's are taken out of a MySQL database.

    Maybe if you saw what I'm talking aobut it would be easier to help. Here is a link to what will be the main page of my site (please note that it is still being worked on and closed to the public). http://xtremetuning.net/index.php

    You can click on the links to the right or go through the entire database using the keywords in the middle of the page. Its really set up like Yahoo so you should know your way around.

    I want a new window to be opened when the user clicks on a companys website so they don't totally leave mine!!!

    Thanks guys,

    -JRW
    Last edited by jrwap; Feb 14, 2001 at 23:38.


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
  •