我有一个基于 JavaScript 的页面菜单,其中菜单项是从数据库生成的。简单的菜单系统看起来像
function LoadMenus() {
window.fw_menu_1 = new Menu("root",165,17,"Verdana, Arial, Helvetica, sans-serif",11,"#ffffff","#000000","#597B7B","#FFF9DC","left","middle",4,0,1000,-5,7,true,true,true,5,true,true);
fw_menu_1.addMenuItem("Menu Item 1","location='#'");
fw_menu_1.addMenuItem("Menu Item 2","location='#'");
fw_menu_1.addMenuItem("Menu Item 3","location='#'");
fw_menu_1.addMenuItem("Menu Item 4","location='#'");
fw_menu_1.addMenuItem("Menu Item 5","location='#'");
fw_menu_1.addMenuItem("Menu Item 6","location='#'");
fw_menu_1.hideOnMouseOut=true;
}
首先,在我使用之前,IE10 上根本没有显示该菜单
<meta http-equiv="X-UA-Compatible" content="IE=9">
但是当我能够显示菜单时,所有项目都有新的换行符而不是间隔,除了菜单项 6,我用非中断空间的标签替换了常规空间。
任何线索为什么 IE10 将所有常规空格切换到新的换行符?
谢谢
根据请求
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah)
{
this.version = "020320 [Menu; mm_menu.js]";
this.type = "Menu";
this.menuWidth = mw;
this.menuItemHeight = mh;
this.fontSize = fs;
this.fontWeight = "plain";
this.fontFamily = fnt;
this.fontColor = fclr;
this.fontColorHilite = fhclr;
this.bgColor = "#ffffff";
this.menuBorder = 1;
this.menuBgOpaque=opq;
this.menuItemBorder = 1;
this.menuItemIndent = idt;
this.menuItemBgColor = bg;
this.menuItemVAlign = valgn;
this.menuItemHAlign = halgn;
this.menuItemPadding = pad;
this.menuItemSpacing = space;
this.menuLiteBgColor = "#ffffff";
this.menuBorderBgColor = "#777777";
this.menuHiliteBgColor = bgh;
this.menuContainerBgColor = "#ffffff";
this.childMenuIcon = "arrows.gif";
this.submenuXOffset = sx;
this.submenuYOffset = sy;
this.submenuRelativeToItem = srel;
this.vertical = vert;
this.items = new Array();
this.actions = new Array();
this.childMenus = new Array();
this.hideOnMouseOut = true;
this.hideTimeout = to;
this.addMenuItem = addMenuItem;
this.writeMenus = writeMenus;
this.MM_showMenu = MM_showMenu;
this.onMenuItemOver = onMenuItemOver;
this.onMenuItemAction = onMenuItemAction;
this.hideMenu = hideMenu;
this.hideChildMenu = hideChildMenu;
if (!window.menus) window.menus = new Array();
this.label = " " + label;
window.menus[this.label] = this;
window.menus[window.menus.length] = this;
if (!window.activeMenus) window.activeMenus = new Array();
}
function addMenuItem(label, action) {
this.items[this.items.length] = label;
this.actions[this.actions.length] = action;
}