Javascript onclick popup中间浏览器无法打开

I am unable to figure out why this javascript won't work. I am trying to make it open as a popup for a pinterest sharing button, but it continues to open as a tab, I've tried for over few hours. Any leads would be great as this seems to be a simple fix.

<a href="<?php echo 'http://www.pinterest.com/pin/create/button/?url=' . $url . '&media=images/article_images/original/' . $article_image . '&description=' . $article_quote . ''; ?>" 
onClick="return pinterest_click(400, 300)" target="_blank" title="pinterest">0</a>

function pinterest_click(width, height)
{
    var leftPosition, topPosition;
    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
    u=location.href;
    media=<?php echo 'images/article_images/original/' .$article_image ?>;
    description=<?php echo $article_quote;?>;
    window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent(u)+'&media='+encodeURIComponent(media)+'&description='+encodeURIComponent(description),'sharer', windowFeatures);
    return false;
}

Following is a corrected version of your function. You missed a couple of quotes in lines 'media=...' and 'description=...'.

function pinterest_click(width, height)
{
    var leftPosition, topPosition;
    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
    u=location.href;
    media="<?php echo 'images/article_images/original/' .$article_image ?>";
    description="<?php echo $article_quote;?>";
    window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent(u)+'&media='+encodeURIComponent(media)+'&description='+encodeURIComponent(description),'sharer', windowFeatures);
    return false;
}

Check out a working version at http://jsfiddle.net/7APYC/ .

Try After removing target="_blank" from link...

The code looks fine to me.

But I have a question and that is,

Why are you using anchor tag and adding the url in the href while you are already having the url in your javascript function.

I would suggest you to use a or simply and on it's click call your javascript function and it should work.

Because you are writing the URL in the href attribute therefore your on click is not working.

Try

<a href="Javascript:;" onClick="return pinterest_click(400, 300)" target="_blank"  
title="pinterest">0</a>