SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    java script help

    Hello Everyone

    We are using the following code on one of our sites:

    <script>
    function url_1()
    {
    URL = 'http://' + location.host.substr(0,location.host.length - 3)
    + '/page3.php';
    open( URL );
    }
    </script>

    <a href="javascript:url_1();" onMouseOver="status='';
    return true;">Go to page 3</a>


    What it does is it makes a link and takes off all the information to the right of the URL and adds /page3.php to it. Example http://www.yoursite.com:20/hello/comein/now.php to http://www.yoursite.com/page3.php .


    The problem is when the link is clicked it opens another browser window. Does anyone know how to make it open the page in the current window? Adding a target tag does not change anything.

    Thanks
    bluey

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use window.location.href instead of open

  3. #3
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Andrew

    Thank you, that work great.

    bluey


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
  •