View: 2373|Reply: 10
|
kat mana silap php coding aku nih? plzzz help me...
[Copy link]
|
|
assalamualaikum suma..
aku ni tgh wat cdoding php utk tukar2 background color
means user leh pilih color and tuka background color system tuh..
aku display color picker tuh javascript, tp aku de prob kat file .php ngan css aku ni..
file zz.php
<?php
$bgColor = $_POST['backColor'];
echo $bgColor;
?>
<link rel="stylesheet" type="text/css"
media="screen" href="style.php">
<script language="JavaScript">
function BtnOkClicked()
{
document.getElementById("bgCol" .value = SEL_COLOR;
}
</script>
<html>
<body>
<form method="post" action="style.php?bg=000023">
<div class="divSection">
<br>BACKGROUND:<br>
Choose A color: <input type="text" id="bgCol" size="12"><input type="button" value="..." ><BR>
<br><br>
<input name="change" type="submit" value="Change Now">
<!--COLOR PICKER WIDGET BEGIN -->
<div style="position:absolute;border:1px solid black;background-color:white;display:none;width:337px;height:375px;" id="main" imgLoc="./">
</div>
<script language="JavaScript" src="cpick.js"></script>
<!--COLOR PICKER WIDGET END -->
</form>
</body>
</html>
style.php
<?php
$id = $_GET['bg'];
echo $id;
$white = $id;
$dkgray = '#333444';
$dkgreen = '#008400';
?>
body {
background:<?=$white?>;
color:<?=$dkgray?>;
}
h1, h2, h3, h4 {
color:<?=$dkgreen?>;
}
blockquote {
color:<?=$dkgreen?>;
}
prob kat coding atas ni, cth aku try bwk value bg= #000023 ke page styple.php. tp page ni xleh baca '#' tuh..ouput yg aku dpt cmnih..
body { background:; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
aku try lg satu cara, aku buang '#' tuh aku dpt output cm kat bwh tp color tetap tak tukar gak...
000023 body { background:#000023; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
tolong..aku tatau dh nak betul kt ner...plzz help me...
[ Last edited by senahsirap at 13-2-2007 02:00 PM ] |
|
|
|
|
|
|
|
takde sape yg nak respond ke...huhuh![](static/image/smiley/default/cry.gif) |
|
|
|
|
|
|
h0ney This user has been deleted
|
aiseh...cian dia...
tp php honey xtau la...asp pon br nk merangkak...![](static/image/smiley/default/tongue.gif) |
|
|
|
|
|
|
_thatDude This user has been deleted
|
cuba gi forum yg more specialize and advanced in programming..my suggestion is sharkyforums.com > Programming &coding & scripting. actually forum ni is very general dan cover many IT issues but the forumners there are quite capable.
good luck |
|
|
|
|
|
|
Mr.Forensics This user has been deleted
|
Reply #1 senahsirap's post
apa poblem yang sebenarnya senah?cuba ko jelaskan lagi sikit..takleh pilih kaler ke...boleh pilih tapi kaler tak bertukar ke..tak phm sikit..aku tgk coding tu pun cam was was |
|
|
|
|
|
|
|
Originally posted by Mr.Forensics at 14-2-2007 05:22 PM
apa poblem yang sebenarnya senah?cuba ko jelaskan lagi sikit..takleh pilih kaler ke...boleh pilih tapi kaler tak bertukar ke..tak phm sikit..aku tgk coding tu pun cam was was
ko tayahla smpai was2..hehe...masalah aku boleh pilih color..tp bila g next page color tak tuka..dh jumpa dah solutionnya..kene guna cookie...hehe..btw tengkiu.. |
|
|
|
|
|
|
|
nak pass string ker page lain pun guna cookie ker?
guna 'get' jer tak bleh ker? |
|
|
|
|
|
|
|
get seperti dalam discussion yang aku baca, takder security. Better guna post |
|
|
|
|
|
|
|
Reply #6 senahsirap's post
as an alternative to cookie, use session variables |
|
|
|
|
|
|
|
takde kena-mengena dengan get atau post, main issue here is to just change the background color.
yang salah tu style.php... sebab rasanya dia cuma baca stylesheet definition upon loading saje... tak dynamic in terms of client events.
u have to use javascript and event-driven concepts, not form submission, to change the background color. just change the properties of the current background color. |
|
|
|
|
|
|
|
try to put these keywords in google: javascript change background color
harap dapat membantu |
|
|
|
|
|
|
| |
|