Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Javascript - Use a bgcolor of a cell and put it in a textbox ?
Old 11-20-2004, 08:23 AM Javascript - Use a bgcolor of a cell and put it in a textbox ?
Novice Talker

Posts: 12
Location: Ireland
Trades: 0
Hello,

I'm looking for a little javascript help, is there any way I can make it when someone clicks on a cell like the one below (onclick) that it takes the bgcolor and puts it into a textbox?

<td bgcolor=\"#FFFF80\" width=\"15\" height=\"15\">&nbsp;</td>

E.g. If i click the above cell, could I make it display #FFFF80 in a textbox beside it?

Thanks in advance for any help.
Bytecon is offline
Reply With Quote
View Public Profile Visit Bytecon's homepage!
 
 
Register now for full access!
Old 11-26-2004, 04:01 AM
Novice Talker

Posts: 8
Trades: 0
You could set the color of a textbox or other type of input through the DOM by using FormName.InputFieldName.style.background=color to set the background color of the input field.

You could set the color to the cell by using this to represent the cell's background color document.getElementById('CellID').style.color

Hope it helps
__________________
<? if (!$succeed){$try++;} ?>

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
services.
Max Powers is offline
Reply With Quote
View Public Profile
 
Old 11-26-2004, 04:24 AM
Unknown.

Posts: 1,693
Trades: 0
This should do what you want...

The cell...

<td bgcolor=\"#FFFF80\" width=\"15\" height=\"15\" onclick=\"box.value=this.getAttribute('bgcolor')\">&nbsp;</td>

The textfield...

<input type=\"text\" id=\"box\">


--James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 11-26-2004, 11:57 AM
Novice Talker

Posts: 12
Location: Ireland
Trades: 0
Thanks alot for the help
Bytecon is offline
Reply With Quote
View Public Profile Visit Bytecon's homepage!
 
Reply     « Reply to Javascript - Use a bgcolor of a cell and put it in a textbox ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41194 seconds with 12 queries