Jump to content

[SOLVED] PHP Onclick Event


CoreyR

Recommended Posts

Anyone know why this wouldn't work? I've tried several different ways and have read several posts.

 

Print "<div class='sponsors_cell'><a href='http://www.sanjoseteam.com/info-request/new-listings-email.html' onclick='window.open('http://www.sanjoseteam.com/info-request/new-listings-email.html', 'contact', 'status=no,resizable=no,width=550,height=560'); return false'><img src='http://www.sanjoseteam.com/images/santa_clara_listings' alt='Blossom Valley Real Estate' width='125' height='125' vspace='4' border='0' /></a><br />";

 

Link to comment
https://forums.phpfreaks.com/topic/49856-solved-php-onclick-event/
Share on other sites

that would be a javascript issue... not a php one... but this should work... simple php function to do just that :-)

 

<?
function popup($text, $link, $name="", $height="300", $width="300", $resizable="0", $status="0", $class=""){
return '<a href="javascript:void(0);" onclick=\'javascript: window.open("'.$link.'", "'.$name.'", "status='.$status.', height='.$height.', width='.$width.', resizable='.$resizable.'")\' class='.$class.'>'.$text.'</a>';
}
?>

Anyone know why this wouldn't work? I've tried several different ways and have read several posts.

 

Print "<div class='sponsors_cell'><a href='http://www.sanjoseteam.com/info-request/new-listings-email.html' onclick='window.open('http://www.sanjoseteam.com/info-request/new-listings-email.html', 'contact', 'status=no,resizable=no,width=550,height=560'); return false'><img src='http://www.sanjoseteam.com/images/santa_clara_listings' alt='Blossom Valley Real Estate' width='125' height='125' vspace='4' border='0' /></a><br />";

 

 

It's because your quotes are canceling out when the HTML gets to the browser. You need to change your quotes around a tad. Try this instead:

<?php
print "<div class='sponsors_cell'><a href='http://www.sanjoseteam.com/info-request/new-listings-email.html' onclick=\"window.open('http://www.sanjoseteam.com/info-request/new-listings-email.html', 'contact', 'status=no,resizable=no,width=550,height=560'); return false\"><img src='http://www.sanjoseteam.com/images/santa_clara_listings' alt='Blossom Valley Real Estate' width='125' height='125' vspace='4' border='0' /></a><br />";
?>

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.