Change web page background color javascript
Change web page background color javascript
Script to change webpage color from the server side are widely available, Even in this website we have 3 different versions of changing webpage background.
Change web page background color javascript
One using PHP
Change background color using php for a webpage
Other two using javascript
A single link that cycles through several webpage background color using javascript
Change webpage background color using javascript
But this script is slightly different, it asks a website user to select the webpage background color and font color they like.We are using document.body.style.color in javascript to change the font color in a webpage.
Here comes the fabulous script that changes webpage font color and also webpage background color by asking input from the user.Have a look
<script> function change_me() { //mistonline.in code Please DONT EDIT THIS <thank you> var color = document.getElementById('color').value var font_color = document.getElementById('f_color').value if(color == "" || font_color == "" ) { alert("Please Enter Valid Color Codes or Names"); } else { document.body.bgColor = color; document.body.style.color = font_color; } } </script>
The HTML code behind the script
Type The Color To Be Changed: <input type="color" name="color" id="color" /> Font color <input type="color" name="f_color" id="f_color" /><b><i><u>For eg: red, black, white, #ff0000, #00000 etc.,</u></i></b><br /> <input type="button" value="Change Color" onclick="javascript:change_me()" />
Very easy to understand just using the basic DOM objects to get the data and update the webpage accordingly. Here is the DEMO
Change web page background color javascript,Incoming search terms:
- (change font in script in javascript) (1)
- using font color in javascript (1)
- update font color in a script (1)
- text color vs background script (1)
- php how to auto detect font color judging on background (1)
- jqgrid row background color (1)
- jqgrid change row color (1)
- how to set value of textbox fom database in yii (1)
- how to change jqgrid onselect font color (1)
- How to change font color with Javascript when the user types in a color (1)
- background color in PHP (1)
- ajaxsubmitbutton yii (1)
- wp customizer update color value via js (1)