-1

How can i make elem.setAttribute("style","border-top-right-radius: 5% 5%;"); To send this elem.setAttribute("style","border-top-right-radius: 5% x%;");

Sett the last 5% to the value of var x.

var element1 = document.getElementById("content"),
style = window.getComputedStyle(element1),
height = style.getPropertyValue('height');

var string1 = height;
string1 = string1.replace(/\D/g,'');

var x = string1 / 100 * 5;
alert(string1);
alert(x);


var elem = document.getElementById("content");
elem.setAttribute("style","border-top-right-radius: 5% 5%;");
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
KevinHaugen
  • 79
  • 1
  • 1
  • 9

2 Answers2

0

You can just concetenate strings:

elem.setAttribute("style","border-top-right-radius: 5% " + x + "%;");
Kenneth
  • 28,294
  • 6
  • 61
  • 84
0

Try this

var x = string1/100 * 5;
elem.setAttribute('style','border-top-right-radius: 5%'+ x +'%;');
Prateek
  • 6,785
  • 2
  • 24
  • 37