|
-
Aug 1st, 2000, 03:02 PM
#1
Thread Starter
Lively Member
how do i change <td> bgcolor??
I want to change a <td> bgcolor property with a mouseover event, and then change in back with a mouseout.
for example:
<td align="center" onMouseOver="changebackground" onMouseOut="originalbackground" bgcolor="gray"><font face="fantasy" color=#FF6600> WEBSITES </font></td>
i tryed just giving the <td> an id and changing the bgcolor as an object and also tryed using a style sheet and accessing it that way, and tryed "this.bgcolor=black" ... none of these seemed to work
can anyone give me any suggestions on how to do this?
thanks,
zack
-
Aug 1st, 2000, 06:54 PM
#2
Lively Member
While I am no expert on HTML or scripting... I took a look at some sources and as far as I can tell you can do it using scripting event like onMouseOver but you still need to declare a scripting language... and also it seems to set a property you need to use the syntax of... onMouseOver='this.bgcolor="Blue";' or at least that is similar to the example they give... bear in mind I am not entirly sure (as I have not tried anything useing scripting events before) of this but hopefully it will give you some help.
-
Aug 2nd, 2000, 08:47 AM
#3
Thread Starter
Lively Member
uhh i said in my post that i tryed that and it doesnt work for <td>
-
Aug 2nd, 2000, 02:40 PM
#4
Frenzied Member
I don't think you can change the bgcolor of a cell.
BUT, wait, don't go away just yet! 
With IE4 you can change the background picture of a cell.
I don't think this is possible with NS though.
So, all you need is 2 small GIFs the required colours and this code:
Code:
<html>
<body>
<TABLE><TR>
<TD ID="td1" onMouseover="document.all.td1.background='blue.gif'" onMouseout="document.all.td1.background='red.gif'" background='red.gif'>hello</TD>
<TD ID="td2" onMouseover="document.all.td2.background='blue.gif'" onMouseout="document.all.td2.background='red.gif'" background='red.gif'>hello</TD>
</TR><TR>
<TD ID="td3" onMouseover="document.all.td3.background='blue.gif'" onMouseout="document.all.td3.background='red.gif'" background='red.gif'>hello</TD>
<TD ID="td4" onMouseover="document.all.td4.background='blue.gif'" onMouseout="document.all.td4.background='red.gif'" background='red.gif'>hello</TD>
</TR></TABLE>
</body
</html>
-
Aug 2nd, 2000, 03:32 PM
#5
Thread Starter
Lively Member
thanks, this accomplishes the same task. nice tip :-)
-
Aug 4th, 2000, 10:39 PM
#6
Junior Member
Dear Highlife,
I hope you haven't been terribly mislead,
by the bizarre comments made in this thread.
The colors of cells are easy to change,
and using gifs is really quite strange.
bgcolor failed because it's all lower case,
try again, but use bgColor in it's place.
Code:
<html>
<head>
</head>
<body>
<table width="200" height="200" border=1><tr>
<td onmouseover="this.bgColor='00ff00'" onmouseout="this.bgColor='ff00ff'">
</td></tr></table>
<table width="200" height="200" border=1><tr>
<td onmouseover="this.bgColor='ffaa00'" onmouseout="this.bgColor='ffff00'">
</td></tr></table>
</body>
</html>
-
Aug 6th, 2000, 02:25 PM
#7
Thread Starter
Lively Member
hmmm, such a simple answer ... thanks for your help. I didn't know JavaScript properties are case sensitive.
you don't realize I have looked through 3 JavaScript books, and all over the web for this answer!
thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|