在html标记中使用javascript

在html标记中使用javascript,javascript,html,Javascript,Html,我有以下代码: <script type="text/javascript"> var screenWidth = window.screen.width; var width_sides = (screenWidth - 980) / 2; </script> <div id="not_important" width=""></div> var screenWidth=window.screen.width; 变量宽度_边=(屏幕宽度-

我有以下代码:

<script type="text/javascript">
var screenWidth = window.screen.width;
var width_sides = (screenWidth - 980) / 2; 
</script>

<div id="not_important" width=""></div>

var screenWidth=window.screen.width;
变量宽度_边=(屏幕宽度-980)/2;
我想将div的宽度设置为javascript标记中等式的结果。我该怎么做

谢谢


var screenWidth=window.screen.width;
变量宽度_边=(屏幕宽度-980)/2;
document.getElementById('not_important')。style.width=width_sides;
<div id="not_important" width=""></div>

<script type="text/javascript">
  var screenWidth = window.screen.width;
  var width_sides = (screenWidth - 980) / 2; 
  document.getElementById('not_important').style.width = width_sides;
</script>