Jump to content

advert popup window problem.


eddbrett

Recommended Posts

Basically I have the following code, which displays a series of adverts on a page and links an image to a url.

The problem I am having is that when an advert is clicked and the new window is displayed, upon closing the window, all adverts still link to the original url. Wondering if there’s a way round this without refreshing the page, I know it’s a JavaScript issue, as it worked fine before I decided to introduce new windows.  Any help is much appreciated, thanks.

 

<?

// Edit this number to however many links you want displaying
$num_displayed = 3 ;

// Select random rows from the database
$result = mysql_query ("SELECT * FROM links ORDER BY RAND() LIMIT $num_displayed"); 

// For all the rows that you selected
while ($row = mysql_fetch_array($result)) 

{
// Display them to the screen...

echo 
"<script>function my_win()
{
window.open('http://" . $row["link"] . 	"','mywindow','width=500,height=500,toolbar=no,location=yes,directories=yes,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes');
};

</script>

<a href=javascript:my_win()> <img src=\" images/" . $row["image"] . "\" border=0 
alt=\"" . $row["text"] . "\" width=\"170\" height=\"170\"\"> <br> </a>";

}
?>

Link to comment
https://forums.phpfreaks.com/topic/86288-advert-popup-window-problem/
Share on other sites

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.