I'm pretty sure this is gonna have to be in php... but let me explain what i'm looking for.

我很确定这一定是在php中…让我解释一下我在找什么。

I have an input box on my site and what ever the user enters in there is set as the css

我的网站上有一个输入框,用户输入的内容被设置为css。

for example

例如

body{
Background-color: [text from the input goes here];
}

5 个解决方案

#1


2

With javascript/jquery you could do this:

使用javascript/jquery,您可以这样做:

see (try putting in #000, or green, or some other color) : http://jsfiddle.net/mH6MK/

参见(尝试输入#000,或绿色,或其他颜色):http://jsfiddle.net/mH6MK/。

$( document ).ready(function() {
   $('input[name=getColor]').change(function() { 
       var $color = $("#getColor").val();
       $('body').css('backgroundColor', $color);
   });
});

or php would be like this:

或者php是这样的

<?
$color = $_GET['color'];
echo '<style type="text/css">body{background:'.$color.';}</style>';
?>

更多相关文章

  1. 更改所选文本的背景颜色,HTML JQUERY
  2. HTML新手求解。关于CSS对于li标签的active状态的背景颜色
  3. HTML5中canvas实现矩形颜色渐变
  4. html2canvas 识别 svg 解决方案
  5. IE8:Div悬停仅在设置背景颜色时有效,非常奇怪,为什么?
  6. HTML5用户身份认证源代码:注册、登录、会话保持的解决方案
  7. 用于在表中强制换行的PHP或HTML/CSS解决方案
  8. 如何控制html代码中DL标签的颜色?
  9. 如何实现分布式文件上传解决方案?

随机推荐

  1. Error generating final archive: Debug
  2. 推送功能,(服务器向android客户端推送信息,
  3. Android 菜单(OptionMenu)
  4. android 笔记 02
  5. Android的StatusBar资料收集
  6. Android属性之build.prop生成过程
  7. 聊天室服务端
  8. Android(安卓)从缓存中读取图片并异步加
  9. Android利用Fiddler进行网络数据抓包
  10. Android存储访问及目录