我想从我的HTML页面调用函数getWidth(heading)
并将其设置为变量width
,如下所示:
HTML页面:
div> style="white-space: nowrap; text-overflow: ellipsis; width:{{getWidth(heading)}}px; overflow: hidden; max-height:48px;" data-ng-bind="$eval('row.' + heading.key) | formatter:heading.format" title="{{$eval('row.' + heading.key) | formatter:heading.format}}">
功能:
$scope.getWidth = function(heading){
return document.getElementById($scope.tableId).scrollWidth*heading.width/100 - 24;
};
我用大括号添加函数的方式.Chrome正在计算宽度,但在IE11中,该函数不起作用。有人可以帮忙吗。
答案 0 :(得分:-1)
HTML:
<div onclick="function(params)">content...</div>
JS:
function name(params) {
var e = document.getElementById("idHere");
e.width = params;
}