I'm a bit of a js newbie, but have read DOM Scripting and a lot of other good stuff on the subject, I'm trying to write a function that will add a link that says print after an element define in the head of the HTML document, this function is in my external js file:

// Add Print Link after an element with the specified id ~ by Brent Lagerman
function addPrintLnk(elementID) {
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var lnkHere = document.getElementById(elementID);
var printLnk = document.createElement("a");
var lnkTxt = document.createTextNode("print");
printLnk.appendChild(lnkTxt);
lnkHere.appendChild(printLnk);
printLnk.onclick = function(){
window.print()
}
}

and I'm calling it like this:

<!--Add Print Links--><script type="text/JavaScript">addPrintLnk('AccessKeys');</script>

it doesn't work obviously or I wouldn't be here - - firebug says addPrintLnk is undefined, but aren't I 'defining' it by adding the argument? I'm sure this is something easy, can anyone help me?

b r e n t