日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

网页分享到微信、微博、QQ空间、百度贴吧等

發(fā)布時間:2025/6/17 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 网页分享到微信、微博、QQ空间、百度贴吧等 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1.首先說明的是,pc端微信分享只能通過二維碼來分享。

2.下面是js代碼。

//分享到新浪微博function shareToSinaWB(event){event.preventDefault();var _shareUrl = 'http://v.t.sina.com.cn/share/share.php?&appkey=895033136'; //真實的appkey,必選參數(shù)_shareUrl += '&url='+ encodeURIComponent(_url||document.location); //參數(shù)url設置分享的內(nèi)容鏈接|默認當前頁location,可選參數(shù)_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //參數(shù)title設置分享的標題|默認當前頁標題,可選參數(shù)_shareUrl += '&source=' + encodeURIComponent(_source||'');_shareUrl += '&sourceUrl=' + encodeURIComponent(_sourceUrl||'');_shareUrl += '&content=' + 'utf-8'; //參數(shù)content設置頁面編碼gb2312|utf-8,可選參數(shù)_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //參數(shù)pic設置圖片鏈接|默認為空,可選參數(shù)window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no, resizable=1,location=no,status=0');}//分享到QQ空間function shareToQzone(event){event.preventDefault();var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';_shareUrl += 'url=' + encodeURIComponent(_url||document.location); //參數(shù)url設置分享的內(nèi)容鏈接|默認當前頁location_shareUrl += '&showcount=' + _showcount||0; //參數(shù)showcount是否顯示分享總數(shù),顯示:'1',不顯示:'0',默認不顯示_shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述'); //參數(shù)desc設置分享的描述,可選參數(shù)_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要'); //參數(shù)summary設置分享摘要,可選參數(shù)_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //參數(shù)title設置分享標題,可選參數(shù)_shareUrl += '&site=' + encodeURIComponent(_site||''); //參數(shù)site設置分享來源,可選參數(shù)_shareUrl += '&pics=' + encodeURIComponent(_pic||''); //參數(shù)pics設置分享圖片的路徑,多張圖片以"|"隔開,可選參數(shù)window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到百度貼吧function shareToTieba(event){event.preventDefault();var _shareUrl = 'http://tieba.baidu.com/f/commit/share/openShareApi?';_shareUrl += 'title=' + encodeURIComponent(_title||document.title); //分享的標題_shareUrl += '&url=' + encodeURIComponent(_url||document.location); //分享的鏈接_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的圖片window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到豆瓣function shareToDouban(event){event.preventDefault();var _shareUrl = 'http://shuo.douban.com/!service/share?';_shareUrl += 'href=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&name=' + encodeURIComponent(_title||document.title); //分享的標題_shareUrl += '&image=' + encodeURIComponent(_pic||''); //分享的圖片window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到騰訊微博function shareToQQwb(event){event.preventDefault();var _shareUrl = 'http://v.t.qq.com/share/share.php?';_shareUrl += 'title=' + encodeURIComponent(_title||document.title); //分享的標題_shareUrl += '&url=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155'; //在騰迅微博平臺創(chuàng)建應用獲取微博AppKey_shareUrl += '&site=' + encodeURIComponent(_site||''); //分享來源_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的圖片,如果是多張圖片,則定義var _pic='圖片url1|圖片url2|圖片url3....'window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到開心網(wǎng)function shareToKaixin(event){event.preventDefault();var _shareUrl = 'http://www.kaixin001.com/rest/records.php?';_shareUrl += 'url=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&content=' + encodeURIComponent('分享的文字'); //需要分享的文字,當文字為空時,自動抓取分享網(wǎng)址的title_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的圖片,多個使用半角逗號分隔_shareUrl += '&showcount=0'; //是否顯示分享數(shù),顯示:'1',不顯示:'0'_shareUrl += '&style=11'; //顯示的樣式,必選參數(shù)_shareUrl += '&aid=' + encodeURIComponent(_site||''); //顯示分享來源window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}function shareToKaixin2(event){event.preventDefault();var _shareUrl = 'http://www.kaixin001.com/repaste/share.php?';_shareUrl += 'rtitle=' + encodeURIComponent(_title||document.title); //分享的標題window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到facebookfunction shareToFacebook(event){event.preventDefault();var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';_shareUrl += 'u=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&t=' + encodeURIComponent(_title||document.title); //分享的標題window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到facebookfunction shareToFacebook(event){event.preventDefault();var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';_shareUrl += 'u=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&t=' + encodeURIComponent(_title||document.title); //分享的標題window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}//分享到Twitterfunction shareToTwitter(event){event.preventDefault();var _shareUrl = 'http://twitter.com/intent/tweet?';_shareUrl += 'url=' + encodeURIComponent(_url||location.href); //分享的鏈接_shareUrl += '&text=' + encodeURIComponent(_title||document.title); //分享的標題window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}

  

轉(zhuǎn)載于:https://www.cnblogs.com/WangXinPeng/p/11504326.html

總結(jié)

以上是生活随笔為你收集整理的网页分享到微信、微博、QQ空间、百度贴吧等的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。