googleplus的javascript代码

googleplus的javascript代码,javascript,Javascript,有人能看看这个javascript中是否缺少一些东西吗 function john() { var w = 480; var h = 380; var x = Number((window.screen.width - w) / 2); var y = Number((window.screen.height - h) / 2); window.open('https://plus.google.com/share?url=' + encodeURIComponent(loc

有人能看看这个javascript中是否缺少一些东西吗

function john() {
  var w = 480;
  var h = 380;
  var x = Number((window.screen.width - w) / 2);
  var y = Number((window.screen.height - h) / 2);
  window.open('https://plus.google.com/share?url=' + encodeURIComponent(location.href) + ' & title = '+encodeURIComponent(document.title),'
      ','
      width = '+w+', height = '+h+', left = '+x+', top = '+y    +',
      scrollbars = no ');
我正在为Muse网站编写google plus共享代码。提前谢谢

function john()
{
var w=480;var h=380;
var x=Number((window.screen.width-w)/2);
var y=Number((window.screen.height-h)/2);
window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'','width='+w+',height='+h+',left='+x+',top='+y    +',  scrollbars=no');
}
1。您的代码中缺少右大括号“}”


2.不要将代码语句拆分为多行,因为Javascript可以自动插入分号。在这种情况下,如果需要将字符串拆分为多行,则可以使用反勾号。

示例中还有一个语法错误。以下是有效的代码:

请点击此处:


从这里开始:谢谢!!!这是一个很大的帮助-现在让链接在IE中工作,我会很高兴:)
function john() {
  var w = 480;
  var h = 380;
  var x = Number((window.screen.width - w) / 2);
  var y = Number((window.screen.height - h) / 2);
  window.open(
    "https://plus.google.com/share?url=" +
    encodeURIComponent(location.href) + 
    "&title=" + 
    encodeURIComponent(document.title),
    "",
    "width=" + w +",height=" + h + ",left=" + x + ",top=" + y +",resizable=yes"
  );
}