document.getElementById(line).css('width', distance + 'px'); code example
Example: how to get width in javascript
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;