Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollbar heigth

Status
Not open for further replies.

sherlock1305

Programmer
Jul 10, 2001
21
0
0
CA
Hi,

first, sorry for my english, it's not my first language!

Here is my question.
Is there a way to control the scroll bar when clicking on it???

I've tried this code...

<SCRIPT>
function ComponentSnapShot(){
var sElem = &quot;&quot;;
sElem = document.body.componentFromPoint(event.clientX, event.clientY);
if (sElem==&quot;scrollbarDown&quot;)
{
window.scrollBy(0,1200);
// alert(&quot;1&quot;);
}
if (sElem==&quot;scrollbarUp&quot;)
{
window.scrollBy(0,-1200);
// alert(&quot;2&quot;);
}
if (sElem==&quot;scrollbarPageDown&quot;)
{
window.scrollBy(0,20);
// alert(&quot;3&quot;);
}
if (sElem==&quot;scrollbarPageUp&quot;)
{
window.scrollBy(0,-20);
// alert(&quot;4&quot;);
}
}
</SCRIPT>
</HEAD>
<BODY onmousedown=ComponentSnapShot() LANGUAGE=javascript>

...but it just works with &quot;Alerts&quot;?!?!?
Does anyone know why?
...or anyone has another solution???

Thanks a lot.
Sherlock
 
Hi,

I am not sure what you are trying to achieve, although i can point out that the command looks wrong because everytime you press the mouse down on the page, you run the script. Is this what you want to do?

James
 
Hi,

Yes, I want to run the script everytime I click on the page and if I click on the scrollbar(if the position of my mouse pointer is on the scrollbar when I click), I want to control how high my scrollbar will move.

Thanks,

Sherlock
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top