-1

I have these codes:

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

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

I want to set the width of the div equal to the result from the equation inside the javascript tagg. How can I do that?

Thanks

0

1 Answer 1

1
<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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.