PDA

View Full Version : Context Menu II and Javascript Functions onClick



KoldFuzun
07-19-2005, 08:43 PM
Context Menu II
http://www.dynamicdrive.com/dynamicindex1/contextmenu2.htm

Doesn't seem to want to execute functions onClick. Can anyone tell me why this won't work?


<TR><TD STYLE="border:1pt solid #F9F8F7" ID="i1" ONMOUSEOVER="document.all.i1.style.background=\'#B6BDD2\';document.all.i1.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="document.all.i1.style.background=\'#F9F8F7\';document.all.i1.style.border=\'1pt solid #F9F8F7\';" ONCLICK="displayIt(\'newFolder\');">&nbsp;<IMG SRC="/snapblast/images/icons/icn_foldernew.gif" WIDTH="12" HEIGHT="11" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;New Folder</TD></TR>

KoldFuzun
07-19-2005, 09:21 PM
Just for reference, here is the function, which i use a LOT and works well. All it does is toggle the visibility of a div

var state = 'hidden';

function displayIt(layer_ref) {
if (state == 'visible') {
state = 'hidden';
} else {
state = 'visible';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}