Reputation: 169
I am new to PHP
and trying to open multiple pages from a single link, such as https://www.google.co.uk, https://www.youtube.com and https://www.stackoverflow.com/ by using code from this answer.
echo "<a href='https://www.google.co.uk' onclick=
window.open('https://www.youtube.com');
window.open('https://www.stackoverflow.com/');
return true;>multiopen</a>";
When running my code only the first two links, https://www.google.co.uk and https://www.youtube.com, open. the third link, https://www.stackoverflow.com/, does not.
I found this example to execute multiple functions from one single attribute but I cannot seem to replicate the syntax in PHP
. Any help would be much appreciated.
Upvotes: 0
Views: 482
Reputation: 325
you can try the anonymous function:
echo "<a href='https://www.google.co.uk' onclick=\"function(){
window.open('https://www.youtube.com');
window.open('https://www.stackoverflow.com/');
return true;
}\">multiopen</a>";
Upvotes: 1