473,385 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PageUp and PageDown button!

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 (Dy*********@home.com) 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(aut o,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.t op)
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.t op)
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>

Jul 20 '05 #1
1 5509
In article <bv**********@bowmore.utu.fi>, wa*********@hotmail.com
enlightened us with...
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.


Oh, this explains it.
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

Your script won't work on my favorite browser (Opera), either. Or any
browser besides Netscape or IE. I sure hope this is for an intranet
application...

There is more wrong with that script than I have time to post.
Especially since document.all, last I heard, was very possibly going
away in IE.
Oh, and when the doctype is set properly, not in quirks mode, in IE, the
whole thing is fubar. I bet the HTML doesn't validate, either.

As to the reason it won't work in NN, I get the error
document.scrollArea has no properties
This would be because scrollArea is a div. It needs
document.getElementById("scrollArea");
Correcting this and using .style.top instead of top leads me to an error
with clip. I don't use clip, so I give up there.

Have fun. :)
--
--
~kaeli~
Never say, "Oops!"; always say, "Ah, interesting!"
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Skip Hollowell | last post by:
I am working on a menu bar for a site, and am using buttons in the bar (because the customer wants to use accessKeys for each selection, apparently it is too much work to click on them with a...
1
by: Harald Solvberg | last post by:
I want a datagrid object that will not intercept PageUp or PageDown keystrokes so that instead the tabcontrol it's on can pick it them up and change TabPages. Any idea how to create a new version...
25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
2
by: Phil Galey | last post by:
I have a Panel control docked on all sides on a form and the panel control contains a PictureBox. I'm using the KeyDown event of the form to respond to the and keys for resizing the image and the...
0
by: =?Utf-8?B?SGFyYWxk?= | last post by:
I have a datagrid on a tabcontrol and want PageUp and PageDown to change tabs on the tabcontrol but when on the datagrid the keystrokes get captured by the datagrid. I've created my own datagrid...
1
by: eben12 | last post by:
Hi guys! I'm currently building web application that make use of the spacebar and I need to disable the automatic pagedown that is taking place when pressing the spacebar. In Firefox, I use the...
2
by: ssubbarayan | last post by:
Dear all, I am in the process of implementing pageup/pagedown feature in our consumer electronics project.The idea is to provide feature to the customers to that similar to viewing a single sms...
27
by: ssubbarayan | last post by:
Hi all, I am looking for some sample code which shows how to implement pageup/ pagedown feature using C language similar to the ones we encounter in our mobile devices.In mobiles if we dont have...
9
by: ssubbarayan | last post by:
Dear all, I am in the process of implementing pageup/pagedown feature in our consumer electronics project.The idea is to provide feature to the customers to that similar to viewing a single sms...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.