Jump to content

Create a hyperlink <a> that has multiple targets


ibtreyt

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?

 

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.

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.

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;
 
});

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;
 
});

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.