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>

JS限制 获取动太ID,播放视频的更多相关文章

  1. Python+Tornado+Tampermonkey 获取某讯等主流视频网站的会员视频解析播放

    近期,<哪吒之魔童降世>在各大视频软件可以看了,然而却是一贯的套路,非会员谢绝观看!!!只能从国内那些五花八门的视频网站上找着看了,或者通过之前本人说的 Chrome 的油猴插件,传送门  ...

  2. 播放视频插件swfobject.js与Video Html5

    播放视频的方法: 方法一. 使用HTML5播放 <video src="./files/Clip_480_5sec_6mbps_h264.mp4" width="1 ...

  3. Android 播放视频并获取指定时间的帧画面

    最近做的项目要求既能播放视频(类似于视频播放器),又能每隔1s左右获取一帧视频画面,然后对图片进行处理,调查了一周,也被折磨了一周,总算找到了大致符合要求的方法.首先对调查过程中涉及到的方法进行简单介 ...

  4. javascript JSMpeg.js 播放视频解决不用全屏也能播放(也支持自动播放哦)

    javascript JSMpeg.js 播放视频解决不用全屏也能播放(也支持自动播放哦) 缺陷就是 因为采用的是 MPEG1解码器 所以清晰度有点低 做直播可以考虑下 如果要清晰度高点 可以采取序列 ...

  5. asp.net js获取控件ID

    ClientID是由ASP.Net生成的服务器控件得客户端标识符,当这个控件生成到客户端页面的时候,在客户端代码访问该控件时就需要通过ClientID来访问. 以文本框为例: 一.未使用母版页 js可 ...

  6. JS如何获取PHP循环中的ID

    JS如何获取PHP循环中的ID  kaalrz 二路公交车    结帖率:83.33%   首先抱歉,因为昨天那帖图片几次都不能用,修改到不能再次修改,今天早上回帖又提示没有这个帖,只好重发一次. 如 ...

  7. js点击获取标签里面id属性

    <html xmlns="http://www.w3.org/1999/xhtml"> <head > <title></title> ...

  8. 关于原生JS获取class,ID等属性的一些封装

    一.传统上获取是通过document.getElementById获取元素的ID属性,通过总结与学习总结一下获取元素class以及id属性的一些封装; 1.创建构造函数,这里面不需要多解释什么:(主要 ...

  9. js如何获取地址栏上的参数id

    直接上js代码   方法1: 父页面跳转地址栏带id>>>>window.location.href='${ctxAdmin}/study/checkForm?id='+id+ ...

随机推荐

  1. Angular2,React集成

    https://www.packtpub.com/books/content/integrating-angular-2-react http://www.syntaxsuccess.com/view ...

  2. gsl安装(Linux系统)

    1. 在gnu的ftp站点http://ftp.gnu.org/gnu/gsl/ 上, 下载最新的gsl-2.x.tar.gz 2. 解压下载好的gsl-2.x.tar.gz 压缩包,$tar -zx ...

  3. sql新建数据库表,及添加多个主键

    create table tb_Modules(module_Id int identity(1,1) primary key,  (自增)model_Name varchar(50) not nul ...

  4. 串string (KMP)

    1.Definition 串string,是零个或多个字符组成的有限序列.一般记作S="a1a2a3...an",其中S是串名,双引号括起来的字符序列是串值:ai(1<= i ...

  5. delphi中nil、null、UnAssigned区别

    nil:空指针,空地址,对象也是指针,所以可以object := nil;null:null是一个未定义值的变量,既不是0也不代表空字符串,它是未定义的.http://www.delphibasics ...

  6. 图片上传预览 支持html5的浏览器

    <img src="" width="100px" height="100px"/> <input type=" ...

  7. 放弃阿里云主机,选择高性价比Vultr VPS免备案

    阿里云主机ECS推广多年后,质量有所改善,但我依然强烈不推荐阿里云主机.考虑性价比带宽速度等因素后,我推荐的vps品牌有vultr和digitalocean,还有大名鼎鼎的linode,是中国用户的最 ...

  8. css样式的部分拓展, NuMber对象、 BoM、 DoM对象的模型的间述,ing...

    css部分代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...

  9. VC 中使用 CToolTipCtrl 消失后不再出现的Bug。。。。

    最近用WTL重写CGdipButton.从ButtonST中将CtoolTipCtrl的相关代码转过来,发现一个问题: ToolTip可以显示,鼠标移开后再移动到button上也可以再次显示,但是按下 ...

  10. 2015 Multi-University Training Contest 7

    1001 Game On the Tree 1002 Tree Maker 1003 Hotaru's problem Manacher处理好p数组. 暴力举一下公共串即可. # include &l ...