Ok, I just started into Javascript. I have an older reference book that has been helping me with syntax, but I have a question. My searches on Google can't seem to answer this, so I'd though I would toss it out here since I have other things I need to do. I'm a C++ coder myself, so I don't need a Javascript primer, just help figuring out how to go about this.
Ok, lets say this... I have a table, 2 buttons, and an iframe in a cell in that table. the 2 buttons are outside the iframe. I want to disable the ordinary scrollbar, and have one button scroll the iframe down when clicked, and the other scroll up when clicked. I want it to work like the normal scroll buttons - when you hold down the button, it keeps scrolling. It'll stop, obviously, whenever you release the mouse button.
Alternatively, I could go with the mouseover scrolling like @ www.sonicmayhem.com - however I don't like mouseover scrolling.
So, gimme some code. If you could comment it for me I'd appreciate it, but it's not necessary since I already have a decent knowledge when it comes to the commands in Javascript pretty well (and have a decent resource at my disposal). I'll give you credit in the source code for whoever helps a reasonable amount
*update, after the below 2 posts because I didn't want to feel guilty about bumping it again *
Ok, here is the source code of the concept for the scroller. When the Scroller function is called, it is passed a number (which determines the direction). When the mouse button is released, it will try to break the loop. However, I get an infinite loop (lockup) whenever I click on one of the buttons - presumeably because it's not capturing the mouseup event. I'm stumped. This is my first javascript stuff though
Ok, lets say this... I have a table, 2 buttons, and an iframe in a cell in that table. the 2 buttons are outside the iframe. I want to disable the ordinary scrollbar, and have one button scroll the iframe down when clicked, and the other scroll up when clicked. I want it to work like the normal scroll buttons - when you hold down the button, it keeps scrolling. It'll stop, obviously, whenever you release the mouse button.
Alternatively, I could go with the mouseover scrolling like @ www.sonicmayhem.com - however I don't like mouseover scrolling.
So, gimme some code. If you could comment it for me I'd appreciate it, but it's not necessary since I already have a decent knowledge when it comes to the commands in Javascript pretty well (and have a decent resource at my disposal). I'll give you credit in the source code for whoever helps a reasonable amount
*update, after the below 2 posts because I didn't want to feel guilty about bumping it again *
Ok, here is the source code of the concept for the scroller. When the Scroller function is called, it is passed a number (which determines the direction). When the mouse button is released, it will try to break the loop. However, I get an infinite loop (lockup) whenever I click on one of the buttons - presumeably because it's not capturing the mouseup event. I'm stumped. This is my first javascript stuff though
Code:
var Counter = 0;
window.captureEvents(Event.MOUSEUP);
function handle(evnt)
{
Counter = 123;
return true;
}
function Scroller(intDir)
{
while(Counter == 0)
{
if (intDir == 1)
mainiframe.scrollBy(0,-10);
else
mainiframe.scrollBy(0,10);
}
}
Last edited: