JS限制 获取动太ID,播放视频

时间:2023-03-09 13:34:23
JS限制          获取动太ID,播放视频

JS限制textarea字数

function textdown(e)
{textevent = e ;
if(textevent.keyCode == )
{
return;
}
if(document.getElementById('text').value.length >= )
{
alert("大侠,我手机屏幕小,先输入这么多字好不?")
if(!document.all)
{
textevent.preventDefault();
}
else
{
textevent.returnValue = false;
}
}
}
function textup()
{
var s = document.getElementById('text').value;
//判断ID为text的文本区域字数是否超过180个
if(s.length > )
{
document.getElementById('text').value=s.substring(,);
}
} 附textarea在html中需要调用的参数:
<textarea id=”text” onKeyDown=”textdown(event)” onKeyUp=”textup()”></textarea>

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[],
height: arrPageSizes[]
}).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[] + (arrPageSizes[] / ),
left: arrPageScroll[]
}).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>
  1. HTML代码部分<a onclick="playFLVA('视频地址')"><img src="图片地址" /></a>