Javascript DOM CSS Style backgroundAttachment Property get

Introduction

Return the value of the background-attachment property:

View in separate window

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

<h1>Hello World!</h1>

<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>
<p>The background-image is fixed.</p>

<button onclick="myFunction()">Get background-attachment value</button>
<p id="demo"></p>
<script>
function myFunction() {/* w ww  . j av  a 2  s  .  c o  m*/
  document.getElementById("demo").innerHTML = document.body.style.backgroundAttachment;
}
</script>

</body>
</html>



PreviousNext

Related