Hi,

I am developing a website that allows users to be able to navigate the website by only clicking on a soft switch. All links are rotated through an array when a link is highlighted and the user clicks the link it is selected. I need to be able to scroll the div1 contents up and down by use of an onmousedown event but I am not sure where to put it? Should it be in the javascript code or should it be placed when calling the javascript from the array.

*The user clicks on rotate8

<img src="images/scrollup1.jpg" name="Rotate9" width="70" height="70" id="Rotate9">___
<img src="images/scrolldown1.jpg" name="Rotate8" width="70" height="70" id="Rotate8"></a></a>

*This says to the the array7 to run the javascript 

arrayLinks[7]="javascript:scrollDivDown(id)";
arrayLinks[8]="javascript:scrollDivUp(id)";

*This is the javascript

<script>
defaultStep=1
step=defaultStep
function scrollDivDown(id){
document.getElementById(id).scrollTop+=step 
timerDown=setTimeout("scrollDivDown('"+id+"')",5)
}


function scrollDivUp(id){
document.getElementById(id).scrollTop-=step
timerUp=setTimeout("scrollDivUp('"+id+"')",5)
}
</script>

But where should I put the mousedown event as it is not working and I have tried different ways.
Any help would be great thank you.

Recommended Answers

All 2 Replies

well, it's not really Java related.
there are multiple jQuery libraries out there that you can use to get this kind of functionality, have you checked those out?

Opps sorry wasn't to sure what category I should put it under. Well I wouldn't be to sure of where to look for this type of functionality. Would I not have the same issue of not knowing where to put the onmousedown event? Thanks for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.