Changing Colors Code

Started on the old forum in September 2008 · view the original in the archive · old links redirect here

16 replies · 1,091 views · started 18 years ago · 1 min read

4 participants
honkytonkman Senior · 252 posts #1

hi, is it possible to put on a chat in txt files a select code for changing background colors on chat page?.. something like this..

echo "choose colors: <select name=\"colors\">";
echo "<option value=body bgcolor=\"white\" link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">white</option>";
echo "<option value=body bgcolor=\"blue\" link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">blue</option>";
echo "<option value=body bgcolor=\"yellow\" link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">yellow</option>";

echo "</select> ";

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

something else Fellow · 2,296 posts #2

something like this:

echo "choose colors: <select name="colors">"; echo "<option value="white">white</option>"; echo "<option value="blue">blue</option>"; echo "<option value="yellow">yellow</option>"; echo "</select> ";

////////////////////////////////////////////// your adjusting page:

$colors = $_POST["colors"];

if($colors=="white"){ $bgcolor = "$colors"; $link = "#0000CC"; }else if($colors=="blue"){ $bgcolor = "$colors"; $link = "#0000CC"; }else if($colors=="yellow"){ $bgcolor = "$colors"; $link = "#0000CC"; }

then update to txt 🙂

honkytonkman Senior · 252 posts #3

maybe i've done ,of course ,somethin' wrong....it don't works..

i've put on the top of chat.php page the code:

$colors = $_POST["colors"];

if($colors=="white"){ $bgcolor = "$colors"; $link = "#0000CC";

}else if($colors=="blue"){ $bgcolor = "$colors"; $link = "#0000CC";

}else if($colors=="yellow"){ $bgcolor = "$colors"; $link = "#0000CC";

}

and then:

echo "<form action="chat.php" method="post">\n"; echo "choose colors: <select name="colors">"; echo "<option value="white">white</option>"; echo "<option value="blue">blue</option>"; echo "<option value="yellow">yellow</option>"; echo "</select> "; echo "<input type="submit" value="ok"> \n";

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

learner Lead · 587 posts #4

changing colors without txt php only

<? 
$today = date("l");
print("$today");
  if($today == "Sunday") 
  {
     $bgcolor = "#FEF0C5";
  }
  elseif($today == "Monday")
  {
     $bgcolor = "#FFFFFF";
  } 
  elseif($today == "Tuesday") 
  {
     $bgcolor = "#FBFFC4";
  } 
  elseif($today == "Wednesday")
  {
     $bgcolor = "#FFE0DD";
  } 
  elseif($today == "Thursday")
  {
     $bgcolor = "#E6EDFF";
  } 
  elseif($today == "Friday") 
  {
     $bgcolor = "#E9FFE6";
  } 
  else 
  {
     // Since it is not any of the days above it must be Saturday
     $bgcolor = "#F0F4F1";
  }
print("<body bgcolor=\"$bgcolor\">\n"); 
?>

Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

BEST MOBILE ADVERTISER

External image (may be gone)

learner Lead · 587 posts #6

here function

function gettheme($uid)
{
    $thid = mysql_fetch_array(mysql_query("SELECT thid FROM ibwf_mypage WHERE uid='".$uid."'"));
    if($thid[0]==""||$thid[0]==0)$thid[0]=1;
    $thinfo = mysql_fetch_array(mysql_query("SELECT bgc, txc, lnk, hdc, hbg, brdr FROM ibwf_themes WHERE id='".$thid[0]."'"));
    $ret = "<style type=\"text/css\">\n";
    $ret .= "body {background-color:#$thinfo[0]; font-family : Comic Sans MS; font-size: medium; margin: 0px; padding: 2px; color:#$thinfo[1]}\n";
      $ret .= "p {padding:0px;}\n";
      $ret .= "input, select {color:#$thinfo[1]; border: 1px ridge #$thinfo[5]; font-family: Comic Sans MS, Tahoma, Verdana; font-weight: bold; background-color:#$thinfo[0]}\n";
      $ret .= "* {text-decoration:none;}\n";
      $ret .= "img {border: 0px none;}\n";
      $ret .= "a, a:active, a:visited, a:hover {color:#$thinfo[2];}\n";
      $ret .= "head {font-family : Comic Sans MS; font-size: medium;}\n";
      $ret .= "div {margin: 2px 0px 2px 0px; padding: 2px 0px 2px 0px; color: #$thinfo[0]; background-color: #$thinfo[5]; border: 1px solid #$thinfo[2]; text-align: center;}\n";
    $ret .= "h3 {background-color:#$thinfo[4]; color:#$thinfo[3]}\n";
    $ret .= "</style>";
    return $ret;
}

rest u must to code

Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

BEST MOBILE ADVERTISER

External image (may be gone)

honkytonkman Senior · 252 posts #7

thanks, but maybe i didn't explain good. my chat works on php xhtml with txt files (no database sql)

so what i need is a a simple choose colors php code( without queries of course) to get on chat page that could work on it (if is it possible)

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

learner Lead · 587 posts #9

something like?

<?php 
$text_size = $_POST['text_size']; 
$font = Trim(stripslashes($_POST['font'])); 
$colour = Trim(stripslashes($_POST['colour'])); 
$brief_colour = Trim(stripslashes($_POST['brief_colour'])); 
$yellow = yellow; 
echo $text_size, $font, $colour, $brief_colour, $yellow; 
?>

 Size of text 
<select name="text_size"> 
<option value ="10">10pt</option> 
<option value ="20">20pt</option> 
<option value ="30" selected="selected">30pt</option> 
<option value ="60">60pt</option> 
</select> 

Font style <select name="font"> 
<option value ="verdana">Verdana</option> 
<option value ="trebuchet">Trebuchet</option> 
<option value ="helvetica" selected="selected">Helvetica</option> 
<option value ="arial">Arial</option> 
</select> 

Font colour <select name="colour"> 
<option value ="black">Black</option> 
<option value ="white">White</option> 
<option value ="red">Red</option> 
<option value ="yellow" selected="selected">Yellow</option> 
</select> 

Brief colour <select name="brief_colour"> 
<option value ="black">Black</option> 
<option value ="white">White</option> 
<option value ="red" selected="selected">Red</option> 
<option value ="yellow">Yellow</option> 
</select> 

<input type="submit" name="submit" value="Show me this text on my briefs"/></p></form>

Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

BEST MOBILE ADVERTISER

External image (may be gone)

learner Lead · 587 posts #10

usase

<?php 
$text_size = $_POST['text_size']; 
$font = Trim(stripslashes($_POST['font'])); 
$colour = Trim(stripslashes($_POST['colour'])); 
$brief_colour = Trim(stripslashes($_POST['brief_colour'])); 
$yellow = 'yellow'; // dont know what this is 
$text = $_POST['personalise']; 
echo "<p style=\"font-family:$font; background-color:$brief_colour; color:$colour; font-size:$text_size;\">\n

\n"; 
?>

Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

BEST MOBILE ADVERTISER

External image (may be gone)

honkytonkman Senior · 252 posts #11

something like this.. CODE<form name="test" method="post">

<input type="button" OnClick="document.bgColor = '#FFFFFF';" value="White">

<input type="button" OnClick="document.bgColor = '#00FFFF';" value="Cyan">

<input type="button" OnClick="document.bgColor = '#FF00FF';" value="Purple">

<input type="button" OnClick="document.bgColor = '#FFFF00';" value="Yellow">

</form> but working in php..

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

something else Fellow · 2,296 posts #12

if its not working in php then close php and reopen it after that code 🙂

honkytonkman Senior · 252 posts #14

do u want this?

CODE?><script>

<!-- document.write(unescape("%3Chtml%3E%0D%0A%3Chead%3E%0D%0A%3CSCRIPT%20language%3D%22JavaScript%22%3E%0D%0A%3C%21--%20hide%20javascript%0D%0A%0D%0Afunction%20changeBackground%28hexNumber%29%20%7B%0D%0A%20%20%20document.bgColor%3DhexNumber%3B%0D%0A%7D%0D%0A%0D%0A//%20done%20hiding%20--%3E%0D%0A%3C/SCRIPT%3E%0D%0A%3C/head%3E%0D%0A%3Cbody%3E%0D%0A%0D%0A%3CFORM%20method%3D%22post%22%20name%3D%22background%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22red%22%0D%0A%20onclick%3D%22changeBackground%28%27%23cc0000%27%29%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22green%22%0D%0A%20onclick%3D%22changeBackground%28%27%23006600%27%29%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22yellow%22%0D%0A%20onclick%3D%22changeBackground%28%27%23ffff99%27%29%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22white%22%0D%0A%20onclick%3D%22changeBackground%28%27%23ffffff%27%29%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22black%22%0D%0A%20onclick%3D%22changeBackground%28%27%23000000%27%29%22%3E%0D%0A%3CINPUT%20type%3D%22button%22%20value%3D%22grey%22%0D%0A%20onclick%3D%22changeBackground%28%27%23666666%27%29%22%3E%0D%0A%3C/FORM%3E%0D%0A%0D%0A%3C/body%3E%0D%0A%3C/html%3E")); //-->

</script><?

yeah this script works! but there's a problem.. 😢 when chat page refresh.. color back to default..

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

rukiya Lead · 569 posts #16

QUOTE(honkytonkman)

something like this.. CODE

<form name="test" method="post">

<input type="button" OnClick="document.bgColor = '#FFFFFF';" value="White">

<input type="button" OnClick="document.bgColor = '#00FFFF';" value="Cyan">

<input type="button" OnClick="document.bgColor = '#FF00FF';" value="Purple">

<input type="button" OnClick="document.bgColor = '#FFFF00';" value="Yellow">

</form>

QUOTE(learner)

do u want this? Attached File(s) color.html ( 1.21K ) Number of downloads: 13

changing background color can easily be done with the basic mark up language html.

but you two r copying and pasting javascripts here which does not support most of mobile phones and I know you two OLD noob know very little about html and nothing about javascript. here is that basic html code

<BODY BGCOLOR=#66FFCC TEXT=#666999 LINK=#0000FF ALINK=#FFFF00 VLINK=#FF0066>

hi how are you?
  <A HREF=index.php>Link</A>

</BODY>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close