下面这段代码做键盘映射的在IE11下运行,会报”缺少标识符、字符串或者数字“,请教怎样改写可以让它适应IE11?
var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;
var key = isMac ? "Cmd" : "Ctrl";
var keyMaps = {
[key + "-1"] : "h1",
[key + "-2"] : "h2",
[key + "-3"] : "h3",
[key + "-4"] : "h4",
[key + "-5"] : "h5",
[key + "-6"] : "h6",
[key + "-B"] : "bold",
[key + "-D"] : "datetime"
}
相关分类