View Full Version : Change A Table BG Color From A Image Button

03-17-2008, 06:03 PM
ok i need some help coding a script...i want to be able to change a table bg image not its color from a another image *Button*..there are 6 buttons, different colors, i want the background image of a table change to each button color that is clicked...the buttons will be at the top and the table image i want to be able to change will be under the buttons....is this possible? please help

03-18-2008, 01:03 AM
Does this help you?

<script type='text/javascript'>
function change_bg(hex, id){
<button onClick="change_bg('0000A5','table_d');">Color1</button> <button onClick="change_bg('7272A3','table_d');">Color2</button>
<button onClick="change_bg('FF967C','table_d');">Color3</button>
<table width="500" height="500" id="table_d"><tr><td></td></tr></table>

Now, all you need to do is add buttons, you should do it like this(the onClick).