hi, i need to dymaically create a thumbnail button that when the user clicks on it, it does 2 things
so i need to call php to echo out <a href commands
1. links to another page called (page1.php)
2. popup another page in new browser called (page2.php) but set this popup in the background
but the problem is <a href only allows 1 page to be linked
how do i do the above?
can anyone show me an example of what should be written in the php echo command?
please help
- hanhao
dynamically creating a image that links to 2 other URLs
Moderator: General Moderators
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Re: dynamically creating a image that links to 2 other URLs
Take a look at the JavaScript function window.open();hanhao wrote:hi, i need to dymaically create a thumbnail button that when the user clicks on it, it does 2 things
1. links to another page called (page1.php)
2. popup another page in new browser called (page2.php) but set this popup in the background
but the problem is <a href only allows 1 page to be linked
how do i do the above?
please help
However, there is no guarantee that a user has JavaScript enabled, so I'd recommend putting an "ordinary" link on each page as well.
aerodromoi
It's HTML and JS and not PHP... But...
Code: Select all
<a href="page1.php" onClick="window.open('page2.php');">Click Here</a>Using the href it's not possible, so you'll probably have to use javascript to do this. But I'm not sure if js is able to open multiple windows (check the client side forum here).
but if I may ask, why would you want to open up a second window in the background? for most users that would probably be very confusing.
but if I may ask, why would you want to open up a second window in the background? for most users that would probably be very confusing.
i need it created dynamicallyok wrote:It's HTML and JS and not PHP... But...
Code: Select all
<a href="page1.php" onClick="window.open('page2.php');">Click Here</a>
so in php it would be this?
Code: Select all
echo "<a href="page1.php" onClick="window.open('page2.php');">Click Here</a>";after it processes, i'll kill it
It would be:
Code: Select all
echo "<a href=\"".$url_page_1."\" onClick=\"window.open('".$url_page_2."');\">Click Here</a>";