11.14.2005

WebCT Anchor

Some of the simplest web page activities become rather tricky when put in the WebCT environment. Like the anchored link -- the link that jumps down or up to a particular spot on your web page. Here is a little trick I recently found to create an anchored link on your WebCT homepage. Say you want to link from a button (e.g. Office Hours) at the top of the homepage to a position at the bottom of the homepage. And say you have three sections on your homepage: an upper textblock, a tool area, and a lower textblock. Your lower textblock contains your office hours preceded by the following anchor name:

<a name="officehours">

In a normal webpage you would simply include the following anchor link code to jump down to a position in the same page:

<a href="#officehours">Office Hours</a>

But in WebCT we have all kinds of javascript going on that needs dealing with. So the simple anchor tag needs to be replaced with the following slightly more complex code:

<a href="javascript:void(self.location='#officehours')">Office Hours</a>

This seems to work well in Campus Edition 4.1. Not sure about 6.0. Cross that bridge when we come to it.

No comments: