开发者

Theme Changer- Help

开发者 https://www.devze.com 2023-01-14 13:33 出处:网络
i have buttons on a page and when the user clicks onto that button, the color of the page changes. basically i`m creating a theme ch开发者_StackOverflow中文版anger. my code is this :

i have buttons on a page and when the user clicks onto that button, the color of the page changes. basically i`m creating a theme ch开发者_StackOverflow中文版anger. my code is this :

function Red() { var Redbtn = document.getElementById("btnRed"); Redbtn.bgColor = "#F00"; } function Blue() { }

Theme changer

ihave done upto the red button but the color of the page do not appears to be red.. please help where im getting problem.


in your html,

<button class="button" id="redButton" /> Red </button>
<button class="button" id="blueButton" /> Blue </button>
<button class="button" id="greenButton" /> Green </button>

in your js file,

$(document).ready(function(){

$('#redButton').click(function() {
    $('body').css('background-color', '#FF0000');
});

$('#greenButton').click(function() {
    $('body').css('background-color', '#00FF00');
});

$('#blueButton').click(function() {
    $('body').css('background-color', '#0000FF');
}); 

});

0

精彩评论

暂无评论...
验证码 换一张
取 消