|
 |
|
รบกวนผู้รู้ค่ะ จะเขียนโค็ดเลือกสี แบบนี้อะค่ะ จะเขียนแบบไหนค่ะ |
|
 |
|
|
 |
 |
|
เอารหัสสีใส่db แล้วค่อยเรียกมาแสดงครับ
มันจะได้ทั้งสองอย่างเลย
อย่างเช่นใช้ddl หรือว่า onclick อะไรงี้อ่ะ
|
 |
 |
 |
 |
Date :
2010-07-20 16:33:11 |
By :
apicha31 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา function ไปลองใช้ดูไหม
Code (PHP)
<input type="text" name="color" size="8" readonly onclick="table_color.style.display=''"/> คลิกที่ช่องเพื่อเลือกสี
<? table_color("color","table_color"); // table_color("ชื่อ input form","id table color เป็นอะไรก็ได้ แต่ต้องกำหนดให้ตรงกับ onclick")?>
<?
function table_color($input,$id_table){
if($input=="show_color" || $input=="show_code_color"){echo " กรุณาตั้งชื่อ inputใหม ่"; }
if($id_table=="show_color" || $id_table=="show_code_color"){echo " กรุณาตั้งชื่อ id table"; }
?>
<table align="center" border="0" cellpadding="2" cellspacing="1" bgcolor="#000000" style="position:absolute; display:none;" id="<?=$id_table?>">
<tr bgcolor="#FFFFFF" class="font12" height="20">
<td colspan="16" ><fieldset style="width:100px; border:1px solid #FFFFFF" id="show_color"></fieldset> <label id="show_code_color"></label></td>
<td colspan="2" align="center" class="font12"><a href="javascript:" onclick="<?=$id_table?>.style.display='none'">ปิด</a></td>
</tr>
<?
$arr_code_color = array("00","33","66","99","CC","FF");
for($n=0;$n<count($arr_code_color); $n=$n+3){
for($R=0;$R<count($arr_code_color); $R++){
?><tr><?
for($L=$n;$L<$n+3; $L++){
for($C=0;$C<count($arr_code_color); $C++){
$color_code = $arr_code_color[$L].$arr_code_color[$C].$arr_code_color[$R];
?><td bgcolor='<?=$color_code?>' width='10' height='10' title='#<?=$color_code?>'
onclick="document.all('<?=$input?>').value='#<?=$color_code?>'; " onmouseover="show_code_color.innerHTML='#<?=$color_code?>'; show_color.style.background='<?=$color_code?>'" onmouseout="show_code_color.innerHTML=''; show_color.style.background=''"></td>
<?
}
}
}
?></tr><?
}
?>
</table>
<? } ?>
|
 |
 |
 |
 |
Date :
2010-07-20 22:17:16 |
By :
heng |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|