How to set the width value?

-1

How can I set a value of a variable, as if it were an equation?

In this case I will have:

var a = document.body.scrollWidth;
var b = 500;
var x = null;

What I need to do is find a number such that a - x = b , regardless of the size of a

    
asked by Eduardo Sebastian 12.09.2017 в 03:23
source

1 answer

0

If someone also needed to know this, I thank Eduen Sarceño, you just calculate:

var x = document.body.scrollWidth - 500; 

That will give me the value of " scrollWidth " of the body minus 500, which then having that variable, I can subtract it from body , to give me 500

    
answered by 12.09.2017 в 12:43