📄 dual-scroller.html
字号:
<HTML>
<HEAD>
<TITLE>JavaScript Source Code 3000: BG Effects: Dual Scroller</TITLE>
<META HTTP-EQUIV="JavaScript Source Code 3000" CONTENT = "no-cache">
<META NAME="description" CONTENT="Scrolls HTML elements within a DIV. A version of the HTML Scroller modified to display a DIV on both the left and right side of the window for both IE and Netscape.">
<META NAME="date" CONTENT="2001-02-07">
<META NAME="channel" CONTENT="Web Developer">
<META NAME="author" CONTENT="">
<META NAME="section" CONTENT="BG Effects">
</HEAD>
<BODY BGCOLOR=#ffffff vlink=#0000ff onLoad="start()">
<BR>
<center>
<table width=600 cellpadding=0 cellspacing=10>
<tr>
<td width=468 align=center>
</td>
<td width=120 align=center>
</td>
</tr>
</table>
<BR>
<BR>
<basefont size=3>
<FONT SIZE="+2" FACE="Helvetica,Arial">
<A HREF="../index.htm" /" TARGET="_top"><FONT COLOR="#0000FF"><b>Home</b></font></A>
<img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}">
<A HREF="index.htm" /bgeffects/"><font color="#FF0000"><b>BG Effects</b></font></A>
<img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}">
<FONT COLOR="#006666"><b>Dual Scroller</b></font></font>
<BR>
<BR>
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td><font FACE="helvetica,arial,geneva">
<br>
<br>
<!-- Description --><!--content_start-->
Scrolls HTML elements within a DIV. A version of the HTML Scroller modified to display a DIV on both the left and right side of the window for both IE and Netscape.
<hr>
</td></tr>
</table>
<!-- Demonstration -->
<div id="point1" STYLE="position:absolute;visibility:visible;">
<img src="../img/logo.gif" /img/logo.gif" width=150 height=48 border=0>
</div>
<div id="point2" STYLE="position:absolute;visibility:visible;">
<img src="../img/logo.gif" /img/logo.gif" width=150 height=48 border=0>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Bruce W.Anderson (appletlib@about.com) -->
<!-- Web Site: http://appletlib.tripod.com/dhtml/elevator.html -->
<!-- Begin
var xPosLeft = 20;
var xPosRight = 800;
var step = 1;
var delay = 30;
var yPos = 0;
var height = 0;
var offset = 0;
var yon = 0;
var name = navigator.appName;
if (name == "Microsoft Internet Explorer") {
yPos = document.body.clientHeight;
xPosRight = document.body.clientWidth - 150;
point1.style.top = yPos;
point2.style.top = yPos;
}
else {
yPos = window.innerHeight;
document.point1.pageY = yPos;
document.point1.visibility = "hidden";
document.point2.pageX = window.innerWidth - 155;
}
function changePos() {
if (yon == 0) {
yPos = yPos - step;
}
else {
yPos = yPos + step;
}
if (name == "Microsoft Internet Explorer") {
height = document.body.clientHeight;
offset = point1.offsetHeight;
}
else {
height = window.innerHeight;
offset = document.point1.clip.height;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - offset)) {
yon = 0;
yPos = (height - offset);
}
if (name == "Microsoft Internet Explorer") {
point1.style.left = xPosLeft;
point1.style.top = yPos + document.body.scrollTop;
point2.style.left = xPosRight;
point2.style.top = yPos + document.body.scrollTop;
}
else {
document.point1.pageX = xPosLeft;
document.point1.pageY = yPos + window.pageYOffset;
document.point2.pageX = xPosRight;
document.point2.pageY = yPos + window.pageYOffset;
}
}
function start()
{
if (name != "Microsoft Internet Explorer") {
document.point1.visibility = "visible";
}
loopfunc();
}
function loopfunc()
{
changePos();
setTimeout('loopfunc()',delay);
}
// End -->
</script>
<P>
<P>
<a name="source">
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td BGCOLOR=yellow><font FACE="helvetica,arial,geneva"><b>JavaScript Source Code 3000: BG Effects: Dual Scroller</b>
<p>Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!
<br><br></font></td></tr>
<tr><td BGCOLOR=yellow ALIGN=CENTER>
<form NAME="copy">
<DIV align="center">
<input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">
<INPUT TYPE="text" NAME="total" VALUE="Script Size: 2.32 KB" size=24>
</DIV>
<textarea NAME="txt" ROWS=20 COLS=75 WRAP=VIRTUAL>
<!-- TWO STEPS TO INSTALL DUAL SCROLLER:
1. Add the onLoad event handler into the BODY tag
2. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="start()">
<!-- STEP TWO: Paste this code into the BODY of your HTML document -->
<div id="point1" STYLE="position:absolute;visibility:visible;">
<img src="../img/logo.gif" width=150 height=48 border=0>
</div>
<div id="point2" STYLE="position:absolute;visibility:visible;">
<img src="../img/logo.gif" width=150 height=48 border=0>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Bruce W.Anderson (appletlib@about.com) -->
<!-- Web Site: http://appletlib.tripod.com/dhtml/elevator.html -->
<!-- Begin
var xPosLeft = 20;
var xPosRight = 800;
var step = 1;
var delay = 30;
var yPos = 0;
var height = 0;
var offset = 0;
var yon = 0;
var name = navigator.appName;
if (name == "Microsoft Internet Explorer") {
yPos = document.body.clientHeight;
xPosRight = document.body.clientWidth - 150;
point1.style.top = yPos;
point2.style.top = yPos;
}
else {
yPos = window.innerHeight;
document.point1.pageY = yPos;
document.point1.visibility = "hidden";
document.point2.pageX = window.innerWidth - 155;
}
function changePos() {
if (yon == 0) {
yPos = yPos - step;
}
else {
yPos = yPos + step;
}
if (name == "Microsoft Internet Explorer") {
height = document.body.clientHeight;
offset = point1.offsetHeight;
}
else {
height = window.innerHeight;
offset = document.point1.clip.height;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - offset)) {
yon = 0;
yPos = (height - offset);
}
if (name == "Microsoft Internet Explorer") {
point1.style.left = xPosLeft;
point1.style.top = yPos + document.body.scrollTop;
point2.style.left = xPosRight;
point2.style.top = yPos + document.body.scrollTop;
}
else {
document.point1.pageX = xPosLeft;
document.point1.pageY = yPos + window.pageYOffset;
document.point2.pageX = xPosRight;
document.point2.pageY = yPos + window.pageYOffset;
}
}
function start()
{
if (name != "Microsoft Internet Explorer") {
document.point1.visibility = "visible";
}
loopfunc();
}
function loopfunc()
{
changePos();
setTimeout('loopfunc()',delay);
}
// End -->
</script>
<!-- Script Size: 2.32 KB --></textarea><br><font FACE="helvetica,arial,geneva"></font></td></tr>
</table>
</form>
</FONT>
</CENTER>
</center>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -