2013-02-12 68 views
0

我有一個基於JavaScript的頁面菜單,其中從數據庫生成菜單項。簡單的菜單系統看起來像Internet Explorer 10 - 新的換行符空格

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; 
} 
+1

我們應該知道addMenuItem是什麼? – epascarello 2013-02-12 20:28:32

+1

或'Menu'?...... – 2013-02-12 20:29:04

+0

添加了兩個腳本。不知道是否與Macromedia JS部分相關,但是用新換行符取代空格很奇怪:\ – JackTheKnife 2013-02-12 20:43:18

回答

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"> 

這是你開始標記之前去。

+0

謝謝,將盡快測試該選項。我在想,缺少文檔類型可能是一個問題,但我無法找到任何有關該問題和IE10的確認。 – JackTheKnife 2013-02-12 22:00:47

+0

我已經添加了doctype,但仍然沒有運氣。當我能夠正確渲染空間時,請參閱下面的回覆。 – JackTheKnife 2013-02-15 17:06:39

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的DOCTYPE添加到你的頁面的最頂部,試圖減輕這些問題:

+0

那麼,仍然沒有運氣。添加了Doctype並得到相同的結果。到目前爲止,當IE10開發窗口設置爲IE5怪癖時,我能夠看到正確填充的菜單 – JackTheKnife 2013-02-15 17:08:10