user experience design and consulting
404.520.0003
info@clickstart.net

Opening context-sensitive help by adding "h_" to the filename

This demo opens a help topic based on the current page's filename.

The advantage of this approach is that you don't have to create map IDs. Instead, just name your help topics using the same filename as your application pages with "h_" as a prefix.For example, "pagename.htm" would have a help topic named "h_pagename.htm."

How to see the demo

Click here: open help window

Code

<script>
function openHelp() {
helpurl = location.href;
begin=helpurl.lastIndexOf('/');
begin = begin + 1;
end=helpurl.lastIndexOf('m');
end=end + 1;
helpurl = "h_" + helpurl.substring(begin, end);
window.open(helpurl, 'helpwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=300,height=200');
}
</script>

<a href="javascript:openHelp()">open help window</a>

How it works

This script uses a function named "openHelp" to open the help window. The openHelp function determines the current page's filename and adds "h_" to the beginning. It can easily be modifed to replace file extensions (for example, to replace .jsp with .htm).

Browser compatibility

This script should work in any browser.

Questions?

Just send us an email.