未命名图片.png

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>一键分享平台</title>
    <style>
        .share-button {
            padding: 10px 20px;
            margin: 10px;
            background-color: #1a73e8;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
 
      }
    </style>
</head>
<body>
    <h1>欢迎使用一键分享平台</h1>
    <p>点击以下按钮分享到社交媒体:</p>
    <!-- 分享按钮-->
    <button class="share-button"onclick="shareToFacebook()">分享到 Facebook</button>
    <button class="share-button"onclick="shareToTwitter()">分享到 Twitter</button>
    <button class="share-button"onclick="shareToLinkedIn()">分享到 LinkedIn</button>
    <button class="share-button"onclick="shareToWhatsApp()">分享到 WhatsApp</button>
    <button class="share-button"onclick="shareToWeibo()">分享到 微博</button>
    <button class="share-button"onclick="shareToQQ()">分享到 QQ空间</button>
 
 
 
    <script>
        // 分享到Facebook
        function shareToFacebook() {
            var url = encodeURIComponent("https://www.google.com");
            var fbUrl = 'https://www.facebook.com/sharer/sharer.php?u=' + url;
            window.open(fbUrl, '_blank', 'width=600,height=400');
 
      }
        // 分享到Twitter
        function shareToTwitter() {
            var url = encodeURIComponent(window.location.href);
            var text = encodeURIComponent("快来看看这个网页!"); // 自定义分享的文本
            var twitterUrl = 'https://twitter.com/intent/tweet?url=' + url + '&text=' + text;
            window.open(twitterUrl, '_blank', 'width=600,height=400');
 
      }
        // 分享到LinkedIn
        function shareToLinkedIn() {
            var url = encodeURIComponent(window.location.href);
            var linkedInUrl = 'https://www.linkedin.com/sharing/share-offsite/?url=' + url;
            window.open(linkedInUrl, '_blank', 'width=600,height=400');
 
      }
        // 分享到WhatsApp
        function shareToWhatsApp() {
            var url = encodeURIComponent(window.location.href);
            var whatsappUrl = 'https://wa.me/?text=' + url;
            window.open(whatsappUrl, '_blank', 'width=600,height=400');
 
      }
        function shareToWeibo() {
            var currentUrl = encodeURIComponent(window.location.href);
            var title = encodeURIComponent("快来看看这个网页!"); // 自定义分享的标题
            var description = encodeURIComponent("我发现了一个有趣的网页,赶紧来看吧!");// 自定义分享的描述
            var weiboUrl = 'http://service.weibo.com/share/share.php?url=' + currentUrl + '&title=' + title + '&content=' + description;
            window.open(weiboUrl, '_blank', 'width=600,height=400');
 
      }
        // 分享到 QQ空间
        function shareToQQ() {
            var currentUrl = encodeURIComponent(window.location.href);
            var qqUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + currentUrl ;
            window.open(qqUrl, '_blank', 'width=600,height=400');
 
      }
    </script>
</body>
</html>