Javascript更改背景颜色和字体大小 [英] Javascript to change background colour and font size

查看:227
本文介绍了Javascript更改背景颜色和字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  input type =buttonname =colrvalue =Blueonclick =document.bgColor ='#0000FF'

基本上我使用javascipt来完成按钮来改变我的网站偏好设置中的背景颜色,但是当页面被刷新后,它会回到它所处的位置css,是否有反正我可以让它停留在不使用cookie的情况下? 解决方案

你需要改变你的设计方法。



如果按钮的颜色是固定的,则应该使用预定义的CSS作为按钮,而不是使用JavaScript来更改。


input type="button" name="colr" value=" Blue " onclick="document.bgColor='#0000FF'"

Basically i have done buttons using javascipt to change the background colour in my website preferences, but when the page is refeshed it goes back to what it is in the css, is there anyway i can get it to stay without using cookies?

解决方案

You would need to change your design approach.

If the button is to have a fixed color, you should use predefined CSS for the button instead of changing it using JavaScript.

这篇关于Javascript更改背景颜色和字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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