【发布时间】:2015-11-26 06:35:28
【问题描述】:
我的代码在 Chrome 中渲染得很好,但在 IE 11 中却没有显示
IE 11 中的问题 - 开发者工具 F12
<li><ul>11/25/15 : <a href="http://server1/coc-home/#/tips/2?paginatePage=1" target="_parent">Dev Test in Supervisor Title</a> By: CBOWER</ul></li>
在 Chrome 中工作 - 开发者工具 F12 输出
<li><ul>11/25/15 : <font color="red"><b>NEW - </b></font><a target="_parent" href="http://server1/coc-home/#/tips/2?paginatePage=1">Dev Test in Supervisor Title</a> By: CBOWER</ul></li>
所以基本上在 IE 11 浏览器中,javascript 完全不渲染字体和粗体
<font color="red"><b>NEW - </b></font> -- missing in IE rendering
我的 Javascript 循环在 Chrome 中呈现的代码
//add red New if date created last 10 days
var dt = new Date(formattedDateString);
var today = new Date();
var newText = "";
var dateDiffDays = Math.ceil((Math.ceil(dt.getTime() - today.getTime())) / (1000 * 3600 * 24));
if (dateDiffDays >= -10 && dateDiffDays <= 10) {
console.log('NEW - date within 10 days');
newText = "<font color='red'><b>NEW - </b></font>";
} else {
console.log('OLD');
newText = "";
}
strResult += "<li><ul>" + formattedDateString + " : " + newText + "<a target='_parent' href='http://" + dochomenotlocal + "/doc-home/#/tips/2?paginatePage=1'>" + news.title + "</a> By: " + news.createdby + "</ul></li>";
更新:
这个 Fiddle 表明它在 IE 11 中可以很好地渲染 javascript 和 css
【问题讨论】:
-
不要使用字体标签...它已被弃用多年。
-
@epascarello - 当然我知道要使用 css,但是 IE 没有显示它的原因是什么?
-
不,不是,原因是你生成的html无效。
标签: javascript html css google-chrome internet-explorer