I have a custom piece of Javascript which softly scrolls the page down with a normal anchor link e.g.<a href="#Bottom"> which used to work fine until I got Javascript to listen out for a Java applet:
The above will listen for an anchor call from a Java Applet with the following code bellow, that anchor being "Top":
The problem is that the first button at the top of my page is a JPG image and uses just a normal anchor link <a href="#Bottom"> which works, the page goes down, but it does not activate the javascript which scrolls the page smoothly. However when at the bottom of the page and I click the Java Applet (which returns a call) the page scrolls up smoothly.
This leads me to believe that the Javascript takes precedence over the HTML anchor call and so I tried turning the a HREF into a JavaScript call like this:
But I think the HTML takes one look at the beginning of this a href call and acts on it, thus the page does not flow, it jumps.
What do I do to get the page to scroll smoothly with an image anchor link?
the smooth scrolling javascript:
my page:
Code:
<script type="text/javascript" language="JavaScript">//<![CDATA[
function JumpToAnchor(anchorName)
{
SoftScroll.init();
SoftScroll.go(anchorName);
}
//]]>
</script>
The above will listen for an anchor call from a Java Applet with the following code bellow, that anchor being "Top":
Code:
void mousePressed() {
JSObject win = (JSObject) JSObject.getWindow(this);
String[] arguments = { "Top" };
win.call("JumpToAnchor", arguments);
}
The problem is that the first button at the top of my page is a JPG image and uses just a normal anchor link <a href="#Bottom"> which works, the page goes down, but it does not activate the javascript which scrolls the page smoothly. However when at the bottom of the page and I click the Java Applet (which returns a call) the page scrolls up smoothly.
This leads me to believe that the Javascript takes precedence over the HTML anchor call and so I tried turning the a HREF into a JavaScript call like this:
Code:
<a href="#Bottom" OnClick="javascript:JumpToAnchor();"><img src="image.jpg"</a>
But I think the HTML takes one look at the beginning of this a href call and acts on it, thus the page does not flow, it jumps.
What do I do to get the page to scroll smoothly with an image anchor link?
the smooth scrolling javascript:
my page: