javascript快进,深入javascript

怎样用javascript实现页面滚动到指定的控件

HTML

创新互联是专业的永宁网站建设公司,永宁接单;提供成都网站设计、做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行永宁网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

HEAD

!-- 滚动区域坐标大小定位--

STYLE type=text/css

#divContainer {

CLIP: rect(0px 294px 20px 0px); HEIGHT: 20px; LEFT: 0px; OVERFLOW: hidden; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; WIDTH: 294px

}

#divContent {

LEFT: 0px; POSITION: absolute; TOP: 0px

}

/STYLE

SCRIPT language=JavaScript

// 滚动开始

function verifyCompatibleBrowser(){

this.ver=navigator.appVersion

this.dom=document.getElementById?1:0

this.ie5=(this.ver.indexOf("MSIE 5")-1 this.dom)?1:0;

this.ie4=(document.all !this.dom)?1:0;

this.ns5=(this.dom parseInt(this.ver) = 5) ?1:0;

this.ns4=(document.layers !this.dom)?1:0;

this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)

return this

}

bw=new verifyCompatibleBrowser()

var speed=0

var loop, timer

function ConstructObject(obj,nest){

nest=(!nest) ? '':'document.'+nest+'.';

this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;

this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;

//内容宽度

this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;

//显示区域宽度

this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth;

this.left=MoveAreaLeft;

this.right=MoveAreaRight;

this.MoveArea=MoveArea; this.x; this.y;

this.obj = obj + "Object";

eval(this.obj + "=this");

return this;

}

function MoveArea(x,y){

this.x=x;this.y=y

this.css.left=this.x

this.css.top=this.y

}

function MoveAreaRight(move){

//alert("this.scrollWidth="+this.scrollWidth+" objContainer.clipWidth="+objContainer.clipWidth+"\n"+" objContainer.clipWidth-this.scrollWidth="+(objContainer.clipWidth-this.scrollWidth)+"\n"+"this.x="+this.x);

document.getElementById("previous").style.display = "block";

document.getElementById("previousq").style.display = "block";

if(this.xobjContainer.clipWidth-this.scrollWidth){

this.MoveArea(this.x-move,0)

if(loop) setTimeout(this.obj+".right("+move+")",speed)

}

else{

document.getElementById("next").style.display = "none";

document.getElementById("nextq").style.display = "none";

}

}

function MoveAreaLeft(move){

document.getElementById("next").style.display = "block";

document.getElementById("nextq").style.display = "block";

if(this.x0){

this.MoveArea(this.x-move,0)

if(loop) setTimeout(this.obj+".left("+move+")",speed)

}

else{

document.getElementById("previous").style.display = "none";

document.getElementById("previousq").style.display = "none";

}

}

//滚动方法

function PerformScroll(speed){

if(initialised){

loop=true;

if(speed0) objScroller.right(speed)

else objScroller.left(speed)

}

}

//停止滚动方法

function CeaseScroll(){

loop=false

if(timer) clearTimeout(timer)

}

//初始化

var initialised;

function InitialiseScrollableArea(){

objContainer=new ConstructObject('divContainer')

objScroller=new ConstructObject('divContent','divContainer')

objScroller.MoveArea(0,0)

objContainer.css.visibility='visible'

initialised=true;

if(objScroller.scrollWidthobjContainer.clipWidth){

document.getElementById("previous").style.display = "none";

document.getElementById("next").style.display = "block";

document.getElementById("previousq").style.display = "none";

document.getElementById("nextq").style.display = "block";

}

}

// 滚动结束

/SCRIPT

/HEAD

BODY onload=InitialiseScrollableArea()

TABLE border=0 cellPadding=0 cellSpacing=0 height=300 width=360

TBODY

TR

TD background=ckh.files/a_r1_c2.jpg

!--滚动区域开始--

DIV id=divContainer style="LEFT: 50px; TOP: 50px; VISIBILITY: visible"

DIV id=divContent

nobr

但一天过去了我始终没有找到合适的配色方案但一天过去了但一天过去了我始终没有找到合适的配色方案但一天过去了但一天过去了我始终没有找到合适的配色方案但一天过去了但一天过去了我始终没有找到合适的配色方案但一天过去了

/nobr

/DIV

/DIV

!--滚动区域结束 --

/TD

/TR

!--滚动按钮开始 --

tr

td id=starttd

DIV id="previousq"

A href="javascript:;" onmouseout=CeaseScroll() onmouseover=PerformScroll(-200)

快进左

/A

/DIV

brbr

DIV id="previous"

A href="javascript:;" onmouseout=CeaseScroll() onmouseover=PerformScroll(-3)

向左

/A

/DIV

/td

td

DIV id="next"

A href="javascript:;" onmouseout=CeaseScroll() onmouseover=PerformScroll(3)

向右

/A

/DIV

brbr

DIV id="nextq"

A href="javascript:;" onmouseout=CeaseScroll() onmouseover=PerformScroll(200)

快进右

/A

/DIV

/td

/tr

!--滚动按钮结束 --

/TBODY

/TABLE

/BODY

/HTML

用什么软件播放m3u8格式可以快进

VLC播放器是可以实现快进的,不过它的客户端并没有用于快进的按钮。你可以在VLC网页播放的javascript中设置input.rate的值实现快进。为1就是1倍速,为2就是2倍速。

JS网页播放器的进度条究竟怎么做 高分求原理及代码 100分

你用的是wmp控件的话,可以参考如下属性:

controls.currentPosition

这个属性可以用来控制当前歌曲播放的进度,可写,比如设置

document.getElementById("wmpid").controls.currentPosition = 18

就是将当前歌曲进到18秒,我没有试过非整数部分可不可以生效(应该是可以的)

controls.currentPositionString

这是个只读属性。比如当前歌曲在18秒出则值为00:18.

至于你说的进度条,控制起来是用event.clientX属性,这是鼠标相对于窗口的横坐标。用这个数字减去那个进度条DIV的clientX属性就是鼠标在进度条上的位置。你自己可以作些加减微调确保结果适当。如果宽度100px,你点的位置是40px.那么用40/100*歌曲长度就是当前应该跳转到的位置了。

加入滑块也很简单,网上有很多drag类,加一个进去稍微调整一下就比较好了

顺便也贴一下wmp组件的基本属性吧,LZ如果没有的话可以稍微参考一下

URL:String; 指定媒体位置,本机或网络地址

uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible

playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪

enableContextMenu:Boolean; 启用/禁用右键菜单

fullScreen:boolean; 是否全屏显示

[controls] wmp.controls //播放器基本控制

controls.play; 播放

controls.pause; 暂停

controls.stop; 停止

controls.currentPosition:double; 当前进度

controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”

controls.fastForward; 快进

controls.fastReverse; 快退

controls.next; 下一曲

controls.previous; 上一曲

[settings] wmp.settings //播放器基本设置

settings.volume:integer; 音量,0-100

settings.autoStart:Boolean; 是否自动播放

settings.mute:Boolean; 是否静音

settings.playCount:integer; 播放次数

[currentMedia] wmp.currentMedia //当前媒体属性

currentMedia.duration:double; 媒体总长度

currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24”

currentMedia.getItemInfo(const string); 获取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述,"Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址

currentMedia.setItemInfo(const string); 通过属性名设置媒体信息

currentMedia.name:string; 同 currentMedia.getItemInfo("Title")

[currentPlaylist] wmp.currentPlaylist //当前播放列表属性

currentPlaylist.count:integer; 当前播放列表所包含媒体数

currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息,其子属性同wmp.currentMedia

播放器界面做的很不错,请继续努力

------

问题补充:

那么 wmp在Firefox下如何控制?

-----

目前我所知道的firefox下同样支持以上属性。只是调用时候要这样object type="application/x-ms-wmp",其他都相同。我用的是firefox3.6,安装了wmp扩展控件。没有安装的用户可能不能正常浏览你的页面。

另外在测试的时候发现直接在原来的object里添加type属性不行,但是用一个新的object可以,原因未知。我想是不是不认clsid的问题。如果真是这样,可能需要用程序判断浏览器然后动态写入相应的object元素?

另外查找资料的时候发现了这篇文章

可以作为参考

以上

用js如何控制 html5 video的快进后退。不要第三方插件。继续代码。

代码如下:

scripttype="text/javascript"functionvidplay() {varvideo =

document.getElementById("Video1");varbutton =

document.getElementById("play");if(video.paused) {

video.play();

button.textContent ="||";

}else{

video.pause();

button.textContent =""

}

}functionrestart() {varvideo = document.getElementById("Video1");

video.currentTime = 0;

}functionskip(value) {varvideo = document.getElementById("Video1");

video.currentTime += value;

}/script/headbodyvideoid="Video1"// Replace these with your own video files.sourcesrc="demo.mp4"type="video/mp4"/

sourcesrc="demo.ogv"type="video/ogg"/HTML5 Video is required for this example.ahref="demo.mp4"Download the video/afile./videodivid="buttonbar"

buttonid="restart"onclick="restart();"[]/buttonbuttonid="rew"onclick="skip(-10)"/buttonbuttonid="play"onclick="vidplay()"/button

buttonid="fastFwd"onclick="skip(10)"/button/div

扩展资料:

注意事项

一、history.pushState(data, title [, url])

往历史记录堆栈顶部添加一条记录;

data: onpopstate事件触发时作为参数传递过去;

title:页面标题,当前所有浏览器都会忽略此参数;

url: 页面地址,可选,缺省为当前页地址;

二、history.replaceState(data, title [, url])

更改当前的历史记录,参数同上;

三、history.state:

用于存储以上方法的data数据,不同浏览器的读写权限不一样;

四、window.onpopstate:响应pushState或replaceState的调用;

HTML实现 后退【window.history.back()】默认

HTML实现 后退【window.history.back(-1)】 括号里面的负数字代表后退几个页面,如果是-2的话就代表后退2页

HTML实现 前进【window.history.forward()】//不常用

HTML实现 前进【window.history.forward(1)】//不常用   括号里面的正数就代表要前进的页。如果是3就表示前进3页

[html] view plain copy

html xmlns=""

head

title/title

/head

body

p这是第一个页面/p

a href="HTMLPage2.htm"到dom页/a

input type="button" onclick="javascript:window.history.back()" value="后退"/

input type="button" onclick="javascript:window.history.forward()" value="前进" /

/body

/html

[html] view plain copy

html xmlns=""

head

title/title

/head

body

p这是第二个页面/p

a href="HTMLPage3.htm"转到第一页/a

a href="javascript:window.history.back()"后退/a

a href="javascript:window.history.forward()"前进/a

/body

/html


文章题目:javascript快进,深入javascript
网页URL:http://scyanting.com/article/dssiphh.html