Javascript DOM CSS Style backgroundRepeat Property get

Introduction

Return the background-repeat value of a document:

alert(document.body.style.backgroundRepeat);

View in separate window

<!DOCTYPE html>
<html>
<body style="background:#f3f3f3 url('image1.png');background-repeat:repeat-y;">

<h1>Hello World!</h1>

<button type="button" onclick="myFunction()">Get background-repeat value</button>
<p id="demo"></p>
<script>
function myFunction() {/*from   w w w. j  a  va2 s. c  om*/
  document.getElementById("demo").innerHTML = document.body.style.backgroundRepeat;
}
</script>

</body>
</html>



PreviousNext

Related