Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Make it open in a new tab instead of a pop up window

    Hello everyone,
    i kinda stuck at this point on my php script, it has this javascript code and i stuck there

    Line 16:
    Code:
    echo("<script language=\"JavaScript\">\nfunction openptc(tpge,pnme,w,h){\nsettings=\"width=\" + w + \",height=\" + h + \",scrollbars=yes,location=no,directories=no,status=1,menubar=no,toolbar=no,resizable=no\";\nwindow.open(tpge,pnme,settings);\n}\n//-->\n</script>");
    Line 72:
    Code:
    print "<td><a href=\"#\" onClick=\"openptc('./paidtoclick.php?adid=$row[linkid]&action=start&".session_name()."=".session_id()."','PaidtoClickPage','640','480');\"><b>Click Here To View</b></a><tr>";
    I think those 2 lines actually are my problem
    I hope you won't get stuck because it's php and javascript and html.

    This code makes the site open in a new pop up window. how to make it open in a new tab

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by Theofilaktos View Post
    This code makes the site open in a new pop up window. how to make it open in a new tab
    That's the user's choice, not yours.
    Millions are still suffering from IE6, which predates the point where everyone copied Opera and implemented tabbed browsing.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,105
    Thanks
    23
    Thanked 594 Times in 593 Posts
    @Theofilaktos Right now, there is no way YOU can open a link in a tab. This is set by the browser. All people that use tabs have things set so a new window opens the tab. Pop-ups will still open pop-ups.

    So, you need to open your link as a new window and let the user decide how he wants to treat that. Erase the javascript function and change the bottom code.
    BUT LOOK at bottom code = It starts with <td> and you never close this. You end the line with <tr>. I will assume you are using the wrong tag and close the <td>.
    FYI an echo executes slightly faster then the print, so it's preferred.

    Just use this in the html link:
    PHP Code:
    echo "<td><a href=\"paidtoclick.php?adid=$row[linkid]&action=start&session_name()=".session_id()."\"><b>Click Here To View</b></a></td>"

    I am curious. Why are you writing your code as php and echoing it out?
    Last edited by sunfighter; 10-09-2011 at 04:23 PM.


  •  

    Posting Permissions

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