javascript按钮切换文档背景颜色 [英] javascript button to toggle document background colour

查看:119
本文介绍了javascript按钮切换文档背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要创建一个带有javascript的按钮,当我点击它时,它会将背景颜色从白色变为黑色和向后。我的意思是,每当我点击它,改变白色和黑色之间的颜色。你能告诉我这个javascript吗?

hi all,
i need to create a button with javascript, that when i click on it, it will change the background color from white to black and backwards. I mean, every time i hit it, change the colo between white and black. Can you please show me the javascript for that?

推荐答案

到目前为止你有什么?


我有改变的代码两种背景颜色之间的点击。这是我想要更改的网页正文的背景颜色。

代码是这样的:

i have code to change between 2 background colors onclick. It is the background
color of the body of the webpage i want to change.
the code is this:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


实际上,整个项目是这样的:我想要一个按钮(或网页中的任何对象,它现在不重要)当我点击它时,它将改变标题'的bg图像 body'的背景颜色,并且还可以向后工作。

Actually, the whole project is like this: I want to have a button(or whatever object in a web page, it''s not important right now) that when i click on it, it will change both the header''s bg image and the body''s background color and also work backwards.

展开 | 选择 | Wrap | 行号


这篇关于javascript按钮切换文档背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆