It works in Konqueror now. The design's nice, the functionality's good, but the code needs work.
Code:
//Browser detection
var ie5=document.all&&document.getElementById;
var ns6=document.getElementById&&!document.all;
Argh! Don't use browser detection!
Code:
document.all["radialMenu"].innerHTML = menuContent;
innerHTML is non-standard and often produces unexpected results. Use DOM functions instead. The same applies to createContextualFragment().
Code:
menuContent+="<a href=\""+tempAr[0]+"\" target=\""+tempAr[1]+"\" onmouseover=\""+rolloverTxtOn+scaleTxtOn+",goTo='"+tempAr[0]+"'\"
You mean ; not , here.
Code:
<img id=\"id0\" width=\""+circle_menu_item_dimension+"px\" height=\""+circle_menu_item_dimension+"px\" src=\""+picDir+"blankbg.png\" style=\"border:0px; position:absolute; left:"+(parseInt((circle_menu_dimension/2)+(circle_menu_radius*Math.sin(y*min_angle_between_items)))-parseInt(circle_menu_item_dimension/2))+"px; top:"+(parseInt((circle_menu_dimension/2)-(circle_menu_radius*Math.cos(y*min_angle_between_items)))-parseInt(circle_menu_item_dimension/2))+"px;\" />
You use the deprecated width and height properties (which don't take units except %, by the way), even though you're using CSS anyway. You also use an XHTML-style self-closing tag, even though the script won't work on XHTML pages due to your use of innerHTML.
Code:
eventObj = e? e:event;
Unnecessarily (and pointlessly, since the event will expire) global object. Could cause all sorts of problems. There are a lot of global functions in your code. You might want to consider putting the whole thing inside a namespacing object of some kind.
Code:
if(window.addEventListener)
{ // Mozilla, Netscape, Firefox
window.addEventListener('load', startup, false);
}
else
{ // IE
window.attachEvent("onload", startup);
}
What if neither exist?
Code:
//Event handlers
function setNavType()
{
if (ie5||ns6)
{
menuobj=document.getElementById("radialMenu"); //Get menu div
menuobj.style.display=''; //Hide menu
document.oncontextmenu=function(){return false}; //Disable Browser Context Menus
if(proNav)
{
document.onmousedown=showMenu;
document.onmouseup=function(){followLink(),hideMenu()};
}
else
{
document.onmousedown=showMenu;
document.onmouseup=function(){followLink()};
document.onclick=hideMenu;
}
}
}
function startup()
{
setNavType();
displayEvenly();
hideMenu();
}
So you rely on DOM events to attach to load, but overwrite any mouse events on the document anyway?
Bookmarks