JS 获取动太ID,播放视频

<script src="js/jquery.js"></script>

<script src="js/alertbox-all.js"></script>

代码如下:

function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;
    }
    arrayPageScroll = new Array(xScroll, yScroll);
    return arrayPageScroll;
}

function getPageSize() {
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = window.innerWidth + window.scrollMaxX;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        if (document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth;
        } else {
            windowWidth = self.innerWidth;
        }
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    // for small pages with total height less then height of the viewport
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }
    // for small pages with total width less then width of the viewport
    if (xScroll < windowWidth) {
        pageWidth = xScroll;
    } else {
        pageWidth = windowWidth;
    }
    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
    return arrayPageSize;
}

function _set_interface() {
    // Apply the HTML markup into body tag
    $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"></div>');
    // Get page sizes
    var arrPageSizes = getPageSize();
    // Style overlay and show it
    $('#jquery-overlay').css({
        backgroundColor: '#000',
        opacity: 0.8,
        width: arrPageSizes[0],
        height: arrPageSizes[1]
    }).fadeIn();
    // Get page scroll
    var arrPageScroll = getPageScroll();
    // Calculate top and left offset for the jquery-lightbox div object and show it
    $('#jquery-lightbox').css({
        top: arrPageScroll[1] + (arrPageSizes[3] / 5),
        left: arrPageScroll[0]
    }).show();
    $('#jquery-overlay,#jquery-lightbox').click(function () {
        $('#jquery-lightbox').remove();
        $('#jquery-overlay').fadeOut(function () { $('#jquery-overlay').remove(); });
    });
}

放在需要放视频的页面里面

<script type="text/javascript">
function playFLVA(url) {	
	_set_interface();
	var info = "<iframe height=498 width=510 src='"+ url +"' frameborder=0 allowfullscreen></iframe>";
	$('#jquery-lightbox').append(info);			  
};
</script>

HTML代码部分

<a οnclick="playFLVA('视频地址')"><img src="图片地址" /></a>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值