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
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>';
}
?>

Link to comment
Share on other sites

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 />";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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