|
So far we have learned how to move content around the page in all directions and we have learned how to limit it. Now you may be asking "What 'else' can we make it do once it reaches the limit?".
Good question... now we come to the else command. The following says, if table3 is less than 560 pixels from the left, then move it 10 pixels to the right....BUT...if table three IS 560 pixels from the left THEN put it at 100 pixels off the screen to the left.....Whereupon the first function is again performed. It is now less that 560 pixels from the left side of the screen and will move 10 pixels each click. if (document.all.table3.style.posLeft < 560) {document.all.table3.style.posLeft +=10} else {document.all.table3.style.posLeft=-100} So this table will go across the screen to the 560 pixel mark, at which point it will again appear on the left and go across the screen again. onClick In the last example we got rid of the rom buttons for a more traditional link. Now we get rid of the sound too, by using onClick only. <a onClick="scrolldemo()"> Hold the button down to try it</a>: Hold the button down to try it Notice the lack of a clicking noise? |