简体   繁体   English

高度属性不适用于Chrome

[英]Height property is not working in chrome

There is a worksheet in my web application. 我的Web应用程序中有一个工作表。 It has used a javascript function to add an empty line to the bottom of that work sheet. 它已使用javascript函数在该工作表的底部添加了空行。 That javascript function looks like below. 该javascript函数如下所示。

ui.app.spreadsheet.FooterDataPadding.prototype.adjustPaddingToFooter = function () {
    this.getDomElement().style.height = this.getApplicationControl().getFooter().getDomElement().offsetHeight;
}

After running the function the html part looks like below. 运行该函数后,html部分如下所示。

div class="ui_app_spreadsheet_FooterPadding-layout " id="util_Document-uid185" style="height: 21px;"

In firefox and IE this works really fine. 在firefox和IE中,这确实可以正常工作。 It adds that 21px high empty line to the bottom of the worksheet. 它将21px高的空行添加到工作表的底部。 But in Chrome, even though it includes in the source, it doesn't show in the UI. 但是在Chrome中,即使它包含在源代码中,也不会在用户界面中显示。 I tried hard to find the solution for this. 我努力寻找解决方案。 But couldn't. 但是不能。 It would be a great help if anyone can find a solution for this. 如果有人可以为此找到解决方案,那将是一个很大的帮助。

Empty Div's sometime show abrupt behaviour in different browsers. 空Div有时会在不同的浏览器中显示突然的行为。

Try to set the innerHTML of the browser to empty or whitespace: 尝试将浏览器的innerHTML设置为空或空白:

document.getElementById('your_elem').innerHTML = '&nbsp';

Hope that helps. 希望能有所帮助。

May be try following: 可以尝试以下操作:

var domElement = this.getDomElement();
domElement.style.height = this.getApplicationControl().getFooter().getDomElement().offsetHeight;
domElement.innerHtml = " "

Or may be concate + "px" in your height statement. 或者可以在身高声明中加上+“ px”。

Or 要么

domElement.innerHTML="<div style='height:" + height + "px;'></div>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM