Reputation: 8457
I'm trying to use this popup function:
function popupwindow(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
On these social links:
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php bloginfo( 'url' ); ?>" title="Share on Facebook"></a>
<a href="http://twitter.com/home?status=<?php the_title(); ?>+<?php bloginfo( 'url' ); ?>" title="Share on Twitter"></a>
<a href="https://plus.google.com/share?url=<?php bloginfo( 'url' ); ?>" title="Share on Google Plus"></a>
Normally, I'd do something like this:
<a onclick="popupwindow('http://www.example.com', 'facebook',400,400);" href="javascript:void(0);">Share on Facebook</a>
But I understand that PHP cannot be used within Javascript because one's server side and one's client side. So how can I make these links pop up?
Upvotes: 0
Views: 274
Reputation: 4771
The above code should actually work and you can place php in with your javascript function just fine just as you did with your a tags in the second example.
If you read through the comments the issue was actually caused by a JavaScript error.
Upvotes: 1