Jump to content

Create a hyperlink <a> that has multiple targets


ibtreyt
Go to solution Solved by Zane,

Recommended Posts

Hey guys,

 

was wondering if there is a way to create 1 <a> tag that has multiple targets, e.g.

 

<a href="www.site1.co.uk" href2="www.site2.co.uk" href="www.site3.co.uk" target="_BLANK">

 

So it has 3 different locations that all open in their own tab. I made a PHP function that looks like this:

<?php

function GetLinks {
  $statement->prepare("SELECT * FROM Links");
  $statement->execute
}

$Links = GetLinks();

foreach ($Links as $Link) {
  echo '<a href="'.$Link.'" target="_BLANK" />'
}


?>

I couldn't make it work though... is there a way I can impliment my objective with PHP?

 

Link to comment
Share on other sites

Your code is the worst thing I've ever seen posted here. Of course it won't work!

 

That said - just what are you trying to do here? Why would you want to send your users to THREE sites at the same time? Whatever is the point of that? And just how are you going to present these sites to the client? Three separate tabbed windows in your browser? Great! I'm happily browsing along and you have this link that I click on and suddenly my browser explodes with stuff! Or as was suggested, you use a JS function (I hope you can write js functions better than you attempted to write a php one!) that will pop up 3 new windows (users just LOVE when that happens!) over the existing window. Is that what you are picturing?

 

Yes - this is harsh, but really - think about what you are proposing.

Link to comment
Share on other sites

Tis rather simple really, if you have multiple events that share the same name - e.g. a quarterly seminar about.. PHP (for instance) and I want to show a client all of them in 1 link instead of me seeming to bombarding them with link after link. and Aye, 3 seperate tabs in 1 window and its not for a website, its for HTML emails.

 

I explained what I wanted, its you who need to think how you talk to beginners instead of discouraging users entirely. Thanks for the help.

Edited by ibtreyt
Link to comment
Share on other sites

  • Solution

Give the anchor tag an id

 

 

<a id='threelinks' href='#'>Open three tabs</a>

 

then use jQuery (or Javascript )

 

 

$("a#threelinks").on('click', function() {
 
     window.open('page1.php', 'first page');
     window.open('page2.php', 'secondpage');
     window.open('page3.php', 'third page');
     return false;
 
});
Link to comment
Share on other sites

Thank you ^.^

 

 

Give the anchor tag an id

<a id='threelinks' href='#'>Open three tabs</a>

then use jQuery (or Javascript )

$("a#threelinks").on('click', function() {
 
     window.open('page1.php', 'first page');
     window.open('page2.php', 'secondpage');
     window.open('page3.php', 'third page');
     return false;
 
});
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.