SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Threaded View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help quick please (javascript)

    I am trying to code a link that has a viariable as the 'target'. Either _top or _blank based on what page they came to the page from.

    Here is my code:
    PHP Code:
    <!--
    var 
    ref;
    var 
    target;
    ref window.location.href;

    function 
    targetnew() {
    if (
    ref.indexOf("/ssi/frames") == -1)
    {
    document.write("target = \"_top\"");
    }
    else (
    ref.indexOf("/ssi/frames") == 1)
    {
    document.write("target = \"_blank\"");
    }}
    //--> 
    I thought I had it working with the link:

    <a href="times.asp" javascript=targetnew()>Times</a>

    But it doesn't work (I'm a newbie =). Is there a simple way to get the function to determine the target?

    Thank you =)
    Last edited by Chad J; Sep 27, 2001 at 14:02.


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
  •