日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

選中后分享到微博的js代碼

 四兩哥 2012-08-28
<!-- 選中后分享到微博 -->
<style>
.img_sina_share{display:none; position:absolute; cursor:pointer;}
.img_qq_share{display:none; position:absolute; cursor:pointer;}
</style>

<img id="imgSinaShare" class="img_sina_share" title="將選中內(nèi)容分享到新浪微博" src="http://www./sj/images/share.gif" />
<img id="imgQqShare" class="img_qq_share" title="將選中內(nèi)容分享到騰訊微博" src="http://www./sj/images/weiboicon32.png" width="26" height="26" />

<script>
var eleImgShare = document.getElementById("imgSinaShare");
var eleImgShare2 = document.getElementById("imgQqShare");
var artMain = document.getElementById("artMain");

var $miniBlogShare = function(eleShare,eleShare2,eleContainer) {
    var eleTitle = document.getElementsByTagName("title")[0];
    eleContainer = eleContainer || document;
    var funGetSelectTxt = function() {
        var txt = "";
        if(document.selection) {
            txt = document.selection.createRange().text;    // IE
        } else {
            txt = document.getSelection();
        }
        return txt.toString();
    };
    eleContainer.onmouseup = function(e) {
        e = e || window.event;
        var txt = funGetSelectTxt(), sh = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
        var left = (e.clientX - 40 < 0) ? e.clientX + 20 : e.clientX - 40, top = (e.clientY - 40 < 0) ? e.clientY + sh + 20 : e.clientY + sh - 40;
        if (txt) {
            eleShare.style.display = "inline";
            eleShare.style.left = left + "px";
            eleShare.style.top = top + "px";
            eleShare2.style.display = "inline";
            eleShare2.style.left = left + 30 + "px";
            eleShare2.style.top = top + "px";
        } else {
            eleShare.style.display = "none";
            eleShare2.style.display = "none";
        }
    };
    eleShare.onclick = function() {
        var txt = funGetSelectTxt(), title = (eleTitle && eleTitle.innerHTML)? eleTitle.innerHTML : "未命名頁(yè)面";
        if (txt) {
            window.open('http://v.t.sina.com.cn/share/share.php?title=' + txt + '&url=' + window.location.href);    
        }
    };
    eleShare2.onclick = function() {
        var txt = funGetSelectTxt(), title = (eleTitle && eleTitle.innerHTML)? eleTitle.innerHTML : "未命名頁(yè)面";
        if (txt) {
            window.open( 'http://v.t.qq.com/share/share.php?title=' + txt + '&url=' + window.location.href);    
        }
    };
}(eleImgShare,eleImgShare2,artMain);

</script>
<!-- 選中后分享到微博 end -->

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多