Y
yihan
Hi,
I would like to make a pageUp and pageDown button to go up or down in the
text ( it is like PgUp/PgDown on the keyboard). But it works on the IE but
not on netscape 7.1. Could somebody tell me the problem? Thanks.
The code as below:
<HTML>
<style type="text/css">
<!--
body
{
font-family:arial;
font-size:11pt;
color:#002000;
background-color:rgb(252,249,197);
width:450;
text-align:justify;
}
-->
</style>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
myBrowser=navigator.appName
myVersion=navigator.appVersion
var version45=(myVersion.indexOf("4.")!=-1||myVersion.indexOf("5.")!=-1)
var NS=(myBrowser.indexOf("Netscape")!=-1 && version45)
var IE=(myBrowser.indexOf("Explorer")!=-1 && version45)
if(!NS&&!IE)alert("This file is intended to run under Netscape versions 4.0+
or Internet Explorer versions 4.0+, and may not run properly on earlier
versions")
if(IE){var hide="hidden"; var show="visible"}
if(NS){var hide="hide"; var show="show"}
//-->
</SCRIPT>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta name=Author content="Francis Hemsher ([email protected]) San Diego,
Ca - 1999">
<meta name=Description content="Dynamic Overlay Example - Using JavaScript
and Cascasding Style Sheets to scroll the segment of a web page" >
<meta name=keywords content="cross browser,Dynamic
HTML,javascript,example,Cascading,html,dynamic
overlay,CSS,dynamic,overlay,cross,browser">
<title>Dynamic Overlay Example - Scrolling A Page Segment</title>
</HEAD>
<body>
<script language=javascript>
<!--
var windowOpen=window.opener
if(!windowOpen && IE)
document.write("<a href=index.html>[HOME]</a><br>")
if(document.referrer=="" && NS)
document.write("<a href=index.html>[HOME]</a><br>")
//-->
</script>
<DIV ID="frame" STYLE="position:absolute;top:300px;left:20px;">
</DIV>
<DIV ID="slider" STYLE="position:absolute;top:325px;left:183px;">
</DIV>
<div id="upBut" STYLE="position:absolute;top:306px;left:180px;">
<a href=javascript:nothing() onmousedown=pageUp() onmouseup=stopUp()
onmouseout=stopUp()>
<img src=upButton.gif border=0></a>
</div>
<div id="downBut" STYLE="position:absolute;top:425px;left:180px;">
<a href=javascript:nothing() onmousedown=pageDown() onmouseup=stopDown()
onmouseout=stopDown()>
<img src=downButton.gif border=0></a>
</div>
<DIV ID="scrollArea" STYLE="position:absolute;top:307px;left:27px;
width:150;font-size:8pt">
This is Crunch the shark, who lives in the deep,
dark ocean.<br>
This is Claude the crab, a fuzzy little fella,
a nice gift for your favorite mother-in-law.
<br>
Lucky, the ladybug brings good tidings to all.
have one
<br>
This spider, named Spinner, a favorite for
acrophobiacs.
<br>
Thanksgiving wouldn't be the same without
Gobbles the turkey.
<p>
</DIV>
<SCRIPT LANGUAGE="JavaScript">
<!-- //
var scrollHeight=500
var scrollTop
var clipBottom =140
var clipTop=0
var clipSlider=0
var t1=null
var t2=null
if(NS)document.scrollArea.clip.bottom=clipBottom
if(IE)document.all.scrollArea.style.clip="rect(auto,auto,"+clipBottom+",auto
)"
function pageDown()
{
if(scrollHeight>0)
{
clipBottom+=5
scrollHeight-=5
if(NS)
{
scrollTop=parseInt(document.scrollArea.top)
document.scrollArea.clip.top +=5
document.scrollArea.clip.bottom=clipBottom
document.scrollArea.top=scrollTop -5
document.slider.clip.top+=1
}
if(IE)
{
scrollTop=parseInt(document.all.scrollArea.style.top)
clipTop += 5
document.all.scrollArea.style.top=scrollTop-5
document.all.scrollArea.style.clip="rect("+clipTop+",auto,"+clipBottom+",aut
o)"
clipSlider=clipSlider+1
document.all.slider.style.clip="rect("+clipSlider+",auto,auto,auto)"
}
t1=setTimeout('pageDown()',10)
}
}
function pageUp()
{
if(scrollHeight<500)
{
clipBottom-=5
scrollHeight+=5
if(NS)
{
scrollTop=parseInt(document.scrollArea.top)
document.scrollArea.clip.top -=5
document.scrollArea.clip.bottom=clipBottom
document.scrollArea.top=scrollTop +5
document.slider.clip.top-=1
}
if(IE)
{
scrollTop=parseInt(document.all.scrollArea.style.top)
clipTop -= 5
document.all.scrollArea.style.top=scrollTop+5
document.all.scrollArea.style.clip="rect("+clipTop+",auto,"+clipBottom+",aut
o)"
clipSlider=clipSlider-1
document.all.slider.style.clip="rect("+clipSlider+",auto,auto,auto)"
}
t2=setTimeout('pageUp()',10)
}
}
function stopUp()
{
clearTimeout(t2)
}
function stopDown()
{
clearTimeout(t1)
}
//-------deactivates onClick
function nothing()
{
}
// -->
</SCRIPT>
</BODY>
</HTML>
I would like to make a pageUp and pageDown button to go up or down in the
text ( it is like PgUp/PgDown on the keyboard). But it works on the IE but
not on netscape 7.1. Could somebody tell me the problem? Thanks.
The code as below:
<HTML>
<style type="text/css">
<!--
body
{
font-family:arial;
font-size:11pt;
color:#002000;
background-color:rgb(252,249,197);
width:450;
text-align:justify;
}
-->
</style>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
myBrowser=navigator.appName
myVersion=navigator.appVersion
var version45=(myVersion.indexOf("4.")!=-1||myVersion.indexOf("5.")!=-1)
var NS=(myBrowser.indexOf("Netscape")!=-1 && version45)
var IE=(myBrowser.indexOf("Explorer")!=-1 && version45)
if(!NS&&!IE)alert("This file is intended to run under Netscape versions 4.0+
or Internet Explorer versions 4.0+, and may not run properly on earlier
versions")
if(IE){var hide="hidden"; var show="visible"}
if(NS){var hide="hide"; var show="show"}
//-->
</SCRIPT>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta name=Author content="Francis Hemsher ([email protected]) San Diego,
Ca - 1999">
<meta name=Description content="Dynamic Overlay Example - Using JavaScript
and Cascasding Style Sheets to scroll the segment of a web page" >
<meta name=keywords content="cross browser,Dynamic
HTML,javascript,example,Cascading,html,dynamic
overlay,CSS,dynamic,overlay,cross,browser">
<title>Dynamic Overlay Example - Scrolling A Page Segment</title>
</HEAD>
<body>
<script language=javascript>
<!--
var windowOpen=window.opener
if(!windowOpen && IE)
document.write("<a href=index.html>[HOME]</a><br>")
if(document.referrer=="" && NS)
document.write("<a href=index.html>[HOME]</a><br>")
//-->
</script>
<DIV ID="frame" STYLE="position:absolute;top:300px;left:20px;">
</DIV>
<DIV ID="slider" STYLE="position:absolute;top:325px;left:183px;">
</DIV>
<div id="upBut" STYLE="position:absolute;top:306px;left:180px;">
<a href=javascript:nothing() onmousedown=pageUp() onmouseup=stopUp()
onmouseout=stopUp()>
<img src=upButton.gif border=0></a>
</div>
<div id="downBut" STYLE="position:absolute;top:425px;left:180px;">
<a href=javascript:nothing() onmousedown=pageDown() onmouseup=stopDown()
onmouseout=stopDown()>
<img src=downButton.gif border=0></a>
</div>
<DIV ID="scrollArea" STYLE="position:absolute;top:307px;left:27px;
width:150;font-size:8pt">
This is Crunch the shark, who lives in the deep,
dark ocean.<br>
This is Claude the crab, a fuzzy little fella,
a nice gift for your favorite mother-in-law.
<br>
Lucky, the ladybug brings good tidings to all.
have one
<br>
This spider, named Spinner, a favorite for
acrophobiacs.
<br>
Thanksgiving wouldn't be the same without
Gobbles the turkey.
<p>
</DIV>
<SCRIPT LANGUAGE="JavaScript">
<!-- //
var scrollHeight=500
var scrollTop
var clipBottom =140
var clipTop=0
var clipSlider=0
var t1=null
var t2=null
if(NS)document.scrollArea.clip.bottom=clipBottom
if(IE)document.all.scrollArea.style.clip="rect(auto,auto,"+clipBottom+",auto
)"
function pageDown()
{
if(scrollHeight>0)
{
clipBottom+=5
scrollHeight-=5
if(NS)
{
scrollTop=parseInt(document.scrollArea.top)
document.scrollArea.clip.top +=5
document.scrollArea.clip.bottom=clipBottom
document.scrollArea.top=scrollTop -5
document.slider.clip.top+=1
}
if(IE)
{
scrollTop=parseInt(document.all.scrollArea.style.top)
clipTop += 5
document.all.scrollArea.style.top=scrollTop-5
document.all.scrollArea.style.clip="rect("+clipTop+",auto,"+clipBottom+",aut
o)"
clipSlider=clipSlider+1
document.all.slider.style.clip="rect("+clipSlider+",auto,auto,auto)"
}
t1=setTimeout('pageDown()',10)
}
}
function pageUp()
{
if(scrollHeight<500)
{
clipBottom-=5
scrollHeight+=5
if(NS)
{
scrollTop=parseInt(document.scrollArea.top)
document.scrollArea.clip.top -=5
document.scrollArea.clip.bottom=clipBottom
document.scrollArea.top=scrollTop +5
document.slider.clip.top-=1
}
if(IE)
{
scrollTop=parseInt(document.all.scrollArea.style.top)
clipTop -= 5
document.all.scrollArea.style.top=scrollTop+5
document.all.scrollArea.style.clip="rect("+clipTop+",auto,"+clipBottom+",aut
o)"
clipSlider=clipSlider-1
document.all.slider.style.clip="rect("+clipSlider+",auto,auto,auto)"
}
t2=setTimeout('pageUp()',10)
}
}
function stopUp()
{
clearTimeout(t2)
}
function stopDown()
{
clearTimeout(t1)
}
//-------deactivates onClick
function nothing()
{
}
// -->
</SCRIPT>
</BODY>
</HTML>