当前位置: 首页 > 实例教程 > 脚本特效 > 动态内容 > 可滚动内容

动态内容
文字/图片自动播放脚本
顶置浮动内容条
内容前后翻页
内容折叠效果
可滚动内容
固定中间渐变提示效果
垂片切换内容
垂片图片内容切换
模拟分页效果
自动隐藏的广告框效果

动态内容 中的 可滚动内容


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-07-27   浏览: 740 ::
收藏到网摘: n/a

可滚动的内容 - 软晨网(RuanChen.com)

DEMO:

- DHTML is the combination of HTML, JavaScript, and CSS

- DOM stands for Document Object Model

- DHTML allows content on a page to change on the fly, without reloading the page

- CSS allows for the separation between content definition and formatting

- CSS stands for Cascading style sheet

- ruanchen provides free, cut and paste DHTML scripts

把代码放入BODY区域便可:

<script type="text/javascript"> iens6=document.all||document.getElementById ns4=document.layers //指定滚动速度 (数字大就越快) var speed=5 if (iens6){ document.write('<div id="container" style="position:relative;width:175px;height:160px;border:1px solid black;overflow:hidden">') document.write('<div id="content" style="position:absolute;width:170px;left:0;top:0">') } </script> <ilayer name="nscontainer" width=175 height=160 clip="0,0,175,160"> <layer name="nscontent" width=175 height=160 visibility=hidden> <p><font size="2" face="Arial">-</font><font size="2" face="Arial"> DHTML is the combination of HTML, JavaScript, and CSS</font></p> <p><font size="2" face="Arial">- DOM stands for Document Object Model</font></p> <p><font size="2" face="Arial">-</font><font size="2" face="Arial"> DHTML allows content on a page to change on the fly, without reloading the page</font></p> <p><font size="2" face="Arial">- CSS allows for the separation between content definition and formatting</font></p> <p><font size="2" face="Arial">- CSS stands for Cascading style sheet</font></p> <p><font size="2" face="Arial">- </font><font size="2" face="Arial"><a href="http://www.">ruanchen</a> provides free, cut and paste DHTML scripts</font></p> </layer> </ilayer> <script language="JavaScript1.2"> if (iens6) document.write('</div></div>') </script> <table width="175px"><td><p align="right"> <a href="#" onMouseover="moveup()" onMouseout="clearTimeout(moveupvar)"><img src="/example/files/b/up.gif" border=0></a> <a href="#" onMouseover="movedown()" onMouseout="clearTimeout(movedownvar)"><img src="/example/files/b/down.gif" border=0></a></p></td> </table> <script language="JavaScript1.2"> if (iens6){ var crossobj=document.getElementById? document.getElementById("content") : document.all.content var contentheight=crossobj.offsetHeight } else if (ns4){ var crossobj=document.nscontainer.document.nscontent var contentheight=crossobj.clip.height } function movedown(){ if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100)) crossobj.style.top=parseInt(crossobj.style.top)-speed+"px" else if (ns4&&crossobj.top>=(contentheight*(-1)+100)) crossobj.top-=speed movedownvar=setTimeout("movedown()",20) } function moveup(){ if (iens6&&parseInt(crossobj.style.top)<=0) crossobj.style.top=parseInt(crossobj.style.top)+speed+"px" else if (ns4&&crossobj.top<=0) crossobj.top+=speed moveupvar=setTimeout("moveup()",20) } function getcontent_height(){ if (iens6) contentheight=crossobj.offsetHeight else if (ns4) document.nscontainer.document.nscontent.visibility="show" } window.onload=getcontent_height </script>

别忘记下载按钮图标

下上

评论 (0) All

登陆 | 还没注册?