InternetExplorer10-换行代替空格
Internet Explorer 10 - new line break insted of spaces
我有一个基于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,所有项目都有新的换行符,在菜单项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;
}
您可能需要按照Microsoft提供的以下文档中的步骤进行操作:http://msdn.microsoft.com/en-us/hh779632.aspx.也可以尝试通过modern.ie上的扫描仪运行它:http://www.modern.ie/report#http%3A%2F%2Fuscib.org%20这可以检测常见问题。
例如,您正在使用一个X-UA-Compatible元标记,该标记强制IE10以IE8模式进行渲染。将内容更改为值到边缘将告诉IE使用可用的最新模式
然后您没有doctype,所以它将以怪癖模式而不是标准模式呈现。由于该脚本很旧,并且有各种非标准代码,如document.all,因此如果将其置于标准模式,IE可能会在这和它应该使用的正确代码之间出现问题。在页面顶部添加HTML5 doctype以尝试缓解这些问题:
在注释中提供的链接中,缺少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">
这在你的开场白之前。
相关文章:
- 如何在正则表达式中匹配空格、换行符
- 正则表达式在换行符 前面有两个空格
- javascript 正则表达式中回车符、换行符和多个空格的匹配
- 替换 JavaScript 中的空格和换行符
- Jquery 和 Contenteditable - 强制换行符显示为单个空格
- JavaScript源代码中的换行符或空格/制表符有什么不同吗?(甚至在评论中!?
- 仅删除空换行符,保留空格
- 正则表达式删除换行符和内容之间的空格
- 删除文本中的空格,同时保留换行符
- 将换行符+4空格替换为
- 如何在javascript中用空格替换换行符
- 如何在不丢失换行符和空格的情况下将js字符串变量传递给php
- 如何在split函数中使用空格和换行符
- 将正则表达式组合为空格和换行符
- 如果多个单词连接在一起,Regex将替换除最后一个非换行空格外的所有空格
- 如何防止IE将文本区换行符转换为单个空格
- 我怎样才能在一个用逗号、换行符或空格分隔的文本区域中计算唯一的电话号码数?
- 用于换行一组不间断空格的正则表达式
- 将所有空格替换为一个,但保留换行符
- 如何清理多个空格/换行符