//分享到腾讯微博 function sharetoqq(content, url, picurl) { var pic; if (picurl && picurl.indexOf("http") < 0) { pic = hostUrl() + picurl; } else { pic = picurl; } var shareqqstring = 'http://v.t.qq.com/share/share.php?title=' + content + '&url=' + encodeURIComponent(url) + '&pic=' + pic; window.open(shareqqstring, 'newwindow', 'height=400,width=600,top=100,left=200'); } //分享到新浪微博 function sharetosina(title, url, picurl) { var pic; if (picurl && picurl.indexOf("http") < 0) { pic = hostUrl() + picurl; } else { pic = picurl; } var sharesinastring = 'http://v.t.sina.com.cn/share/share.php?title=' + title + '&url=' + url + '&content=utf-8&sourceUrl=' + encodeURIComponent(url) + '&pic=' + pic; window.open(sharesinastring, 'newwindow', 'height=400,width=600,top=100,left=200'); } //分享到QQ空间 function sharetoqqzone(title, url, picurl, des) { var pic; if (picurl && picurl.indexOf("http") < 0) { pic = hostUrl() + picurl; } else { pic = picurl; } var shareqqzonestring = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=' + title + '&url=' + encodeURIComponent(url) + '&pics=' + pic + '&summary=' + des; window.open(shareqqzonestring, 'newwindow', 'height=400,width=600,top=100,left=200'); } //分享到QQ function sharetoqq(title, url, picurl, des) { var pic; if (picurl && picurl.indexOf("http") < 0) { pic = hostUrl() + picurl; } else { pic = picurl;} var shareqqzonestring = 'http://connect.qq.com/widget/shareqq/index.html?title=' + title + '&url=' + encodeURIComponent(url) + '&pics=' + pic + '&summary=' + des; window.open(shareqqzonestring, 'newwindow', 'height=400,width=600,top=100,left=200'); } //分享到微信 function sharetoweixin(obj, url) { $(obj).qrcode({ text: url, //设置二维码内容 render: "table", //设置渲染方式 width: 100, //设置宽度,默认生成的二维码大小是 256×256 height: 100, //设置高度 typeNumber: -1, //计算模式 background: "#ffffff", //背景颜色 foreground: "#000000" //前景颜色 }); } function hostUrl() { var port = location.port; var protocol = location.protocol + "//"; var hostUrl; if (port == 80) { hostUrl = protocol + hostname; } else { hostUrl = protocol + location.host; } return hostUrl; }