how to change the color using js
JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Change the Background Color with JavaScript</title>
<script>
// Function to change webpage background color
function changeBodyBg(color){
document.body.style.background = color;
}
// Function to change heading background color
function changeHeadingBg(color){
document.getElementById("heading").style.background = color;
}
</script>
</head>
<body>
<h1 id="heading">This is a heading</h1>
<p>This is a paragraph of text.</p>
<hr>
<div>
<label>Change Webpage Background To:</label>
<button type="button" onclick="changeBodyBg('yellow');">Yellow</button>
<button type="button" onclick="changeBodyBg('lime');">Lime</button>
<button type="button" onclick="changeBodyBg('orange');">Orange</button>
</div>
<br>
<div>
<label>Change Heading Background To:</label>
<button type="button" onclick="changeHeadingBg('red');">Red</button>
<button type="button" onclick="changeHeadingBg('green');">Green</button>
<button type="button" onclick="changeHeadingBg('blue');">Blue</button>
</div>
</body>
</html><!DOCTYPE html>
<html>
<head>
<script>
function display()
{
var col=document.getElementById("demo");
col.style.color="#FF0000";
}
</script>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">click on the button below.....</p>
<button onclick="display()">Display</button>
</body>
</html>
Also in JavaScript:
- Title
- delete node between indexes node list js
- Category
- JavaScript
- Title
- how run dockerfile
- Category
- JavaScript
- Title
- adding bootstrap to angular
- Category
- JavaScript
- Title
- comment obtenir l'élément parent javascript
- Category
- JavaScript
- Title
- deploy angular app on google app engine
- Category
- JavaScript
- Title
- javascript check if boolean is undefined
- Category
- JavaScript
- Title
- angular local storage
- Category
- JavaScript
- Title
- javascript array concat spread operator
- Category
- JavaScript
- Title
- define a route with path paramters in nodejs
- Category
- JavaScript
- Title
- how to loop over dom objects javascript
- Category
- JavaScript
- Title
- how to make a vowel counter in javascript
- Category
- JavaScript
- Title
- body-parser node
- Category
- JavaScript
- Title
- document ready
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- how to add array numbers in javascript
- Category
- JavaScript
- Title
- how to add object to list in javascript
- Category
- JavaScript
- Title
- browser detect javascript
- Category
- JavaScript
- Title
- free map js
- Category
- JavaScript
- Title
- how to play sound on load js
- Category
- JavaScript
- Title
- bot discord comment récupérer la pdp de quelqu'un
- Category
- JavaScript
- Title
- javascript array column
- Category
- JavaScript
- Title
- array find method javascript
- Category
- JavaScript
- Title
- how to add object to array javascript
- Category
- JavaScript
- Title
- get all keys in json object
- Category
- JavaScript
- Title
- add a route to a buttoin in angular
- Category
- JavaScript
- Title
- file input disable open file picker javascript
- Category
- JavaScript
- Title
- delete from array based on value javascript
- Category
- JavaScript
- Title
- how to auto refresh page in javascript
- Category
- JavaScript
- Title
- angular one way property binding
- Category
- JavaScript
- Title
- defineCall is not a function at Sequelize.import sequelize.js
- Category
- JavaScript
- Title
- check if object has method javascript
- Category
- JavaScript
- Title
- go to page jquery
- Category
- JavaScript
- Title
- how to get the height of window in javascript
- Category
- JavaScript
- Title
- angular rebuild
- Category
- JavaScript
- Title
- iso to date javascript
- Category
- JavaScript
- Title
- check row empty array javascript
- Category
- JavaScript
- Title
- how to delete a variable in js
- Category
- JavaScript
- Title
- How to pass variables from js to html node
- Category
- JavaScript
- Title
- delete last element of array js
- Category
- JavaScript
- Title
- changing columns for table requires doctrine dbal install doctrine/dbal
- Category
- JavaScript
- Title
- How to rewrite a function using arrow function syntax
- Category
- JavaScript
- Title
- Angularjs datetime
- Category
- JavaScript
- Title
- how to get selected row index of table in javascript
- Category
- JavaScript
- Title
- Alert.alert closing expo
- Category
- JavaScript
- Title
- angular material toolbar with logo
- Category
- JavaScript
- Title
- compare NaN in javascript if condititon
- Category
- JavaScript
- Title
- filter table search
- Category
- JavaScript
- Title
- git remote url change
- Category
- JavaScript
- Title
- ISS proxy express
- Category
- JavaScript
- Title
- how to add onclick to child element created javascript
- Category
- JavaScript
- Title
- hoisting in javascript
- Category
- JavaScript
- Title
- curl post file json
- Category
- JavaScript
- Title
- inner html jquery
- Category
- JavaScript
- Title
- find substring in string javascript
- Category
- JavaScript
- Title
- how to reset interval javascript
- Category
- JavaScript
- Title
- javascript add to object
- Category
- JavaScript
- Title
- how to use aos in react
- Category
- JavaScript
- Title
- angular run behind proxy
- Category
- JavaScript
- Title
- event target javascript
- Category
- JavaScript
- Title
- check a checkbox jquery
- Category
- JavaScript
- Title
- exponential javascript
- Category
- JavaScript
- Title
- covid
- Category
- JavaScript
- Title
- filter in react native
- Category
- JavaScript
- Title
- get text in select jquery
- Category
- JavaScript
- Title
- clone javascript object
- Category
- JavaScript
- Title
- date object javascript
- Category
- JavaScript
- Title
- convert number to k m b javascript
- Category
- JavaScript
- Title
- how to use ternary operatiion in sequelize join statement
- Category
- JavaScript
- Title
- javascript access pushed element
- Category
- JavaScript
- Title
- disable autocomplete javascript
- Category
- JavaScript
- Title
- anguler test submit form
- Category
- JavaScript
- Title
- array.splice javascript
- Category
- JavaScript
- Title
- javascript add to array
- Category
- JavaScript
- Title
- how the filter() function works javascript
- Category
- JavaScript
- Title
- add readonly attribute jquery
- Category
- JavaScript
- Title
- deno
- Category
- JavaScript
- Title
- hover jquery
- Category
- JavaScript
- Title
- if statement in javascript
- Category
- JavaScript
- Title
- javascript array push
- Category
- JavaScript
- Title
- is game development with javscript wrth it ?
- Category
- JavaScript
- Title
- how to run p5js in a particular section of page
- Category
- JavaScript
- Title
- angular reactive forms
- Category
- JavaScript
- Title
- combine two arrays javascript
- Category
- JavaScript
- Title
- create a react native project
- Category
- JavaScript
- Title
- $pull mongoose
- Category
- JavaScript
- Title
- javascript change attribute
- Category
- JavaScript
- Title
- javascript after dom ready
- Category
- JavaScript
- Title
- how to run mocha tests on asynchronous functions in script
- Category
- JavaScript
- Title
- How do I get Month and Date of JavaScript in 2 digit format
- Category
- JavaScript
- Title
- how to create react app
- Category
- JavaScript
- Title
- how to make javascript function consise
- Category
- JavaScript
- Title
- how to validate input type=date in javascript
- Category
- JavaScript
- Title
- array unique values javascript
- Category
- JavaScript
- Title
- document addeventlistener click
- Category
- JavaScript
- Title
- add custom marker in react-mapbox-gl
- Category
- JavaScript
- Title
- get value of all checked boxes jquery
- Category
- JavaScript
- Title
- button not clicking for random jokes in javascript
- Category
- JavaScript
- Title
- javascript clearinterval
- Category
- JavaScript
- Title
- difference between e.preventdefault and e.stoppropagation and return false
- Category
- JavaScript
- Title
- check if file exists javascript
- Category
- JavaScript