0

我有一个基于 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;
}
4

2 回答 2

1

您可能需要按照以下 Microsoft 文档中的步骤操作:http: //msdn.microsoft.com/en-us/hh779632.aspx。还可以尝试通过modern.ie 上的扫描仪运行它:http ://www.modern.ie/report#http%3A%2F%2Fuscib.org%20这会检测到常见问题。

例如,您正在使用强制 IE10 以 IE8 模式呈现的 X-UA 兼容元标记。将内容更改为值到边缘将告诉 IE 使用可用的最新模式

然后你没有文档类型,所以它将以 quirksmode 呈现,而不是标准模式。由于脚本很旧并且有各种像 document.all 这样的非标准代码,如果你把它放在标准模式下,IE 可能会在这个和它应该使用的正确代码之间跳闸。将 HTML5 文档类型添加到页面的最顶部以尝试缓解这些问题:

于 2013-02-13T00:20:20.793 回答
0

从您在评论中提供的链接中,您缺少 DOCTYPE。

http://www.w3.org/QA/2002/04/valid-dtd-list.html

试试这个:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

这在您的开始标签之前。

于 2013-02-12T21:38:14.387 回答