我有一个用于时间表条目的旧 ASP Web 应用程序,其中充满了 CSS 表达式。它们出现在 CSS 文件中:
.ApptPage {
position : relative;
height : expression(Math.max(document.body.offsetHeight-this.offsetTop-document.body.marginTop,0));
border : 0 solid black;
}
在 ASP 中:
<IFRAME SRC="TimeSheetView.asp?<%=sQueryStandard%>" id=frameContent style="border-left:0;position:absolute;top:0;width:expression(Math.max(0,divContent.offsetWidth-20));height:expression(Math.max(0,divContent.offsetHeight-this.offsetTop));border:0px;left:0px;"></IFRAME>
该应用程序在 IE 上运行良好,但经过 10 多年的使用,我们希望为下一个 10 年做好准备,使其与浏览器无关。
这是我第一次在 CSS 中看到表达式,我不知道如何找到一种方法来替换它?有人有什么建议吗?
最佳答案
这些表达式是 IE
特有的,但它们已被弃用和放弃,甚至 IE
也是如此:
引用:http://msdn.microsoft.com/en-us/library/ms537634%28v=vs.85%29.aspx
As of Windows Internet Explorer 8, dynamic properties have been deprecated and are only supported for Web pages displayed in IE5 (Quirks) mode or IE7 Standards mode.
和
Dynamic properties (also called "CSS expressions") are no longer supported in Internet Explorer 8 and later, in IE8 Standards mode and higher.
您可以使用 JavaScript 或 CSS 或两者的组合来实现这些表达式的作用。
关于html - 如何替换 CSS 表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16615756/