...

View Full Version : Tables III - Highlighting Cells.



ionsurge
10-25-2002, 05:24 PM
How can I highlight the cells of a table on a mouseover event - without using images?


Thanx.


Ionsurge.

ionsurge
10-25-2002, 05:34 PM
I have just figured it out I think.




<A STYLE="color:#FFFFFF;text-decoration:none;" HREF="Link" TARGET="_top" onmouseover="this.style.color='#FFCC00';"

onmouseout="this.style.color='#FFFFFF';">Link</A>&nbsp;



I am checking it out now.


Ionsurge.

redhead
10-25-2002, 05:37 PM
<style>
td.menuon {
background-color: #FFFF00;
}
td.menuoff {
background-color: #FFFFFF;
}
</style>

<table>
<tr>
<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">
Put your mouse here
</td>
</tr>
<tr>
<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">
Or here...
</td>
</tr>
</table>


:thumbsup:

ionsurge
10-25-2002, 05:56 PM
Cheers Redhead, you are a saint!


Ionsurge.

Bosko
10-25-2002, 06:00 PM
td:hover{
background-color: #FFFF00
}
td{
background-color: #FFFFFF;
}

Is alot easier IMHO.

redhead
10-25-2002, 06:08 PM
from a coding point of veiw yes... but it doesnt work in IE... (not for me anyway ;))

ionsurge
10-25-2002, 06:17 PM
Redhead's script works - I uploaded just now, www.ionsurge.com.

Cheers all anyhow.


Ionsurge.

ionsurge
10-25-2002, 07:04 PM
Could it be possible to make the whole cell a link too, so the user can click anywhere in the cell?


Cheers.

Ionsurge.

Nightfire
10-25-2002, 07:52 PM
Give this a try

<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';" onClick="document.location='page.html';">

redhead
10-25-2002, 08:18 PM
if your making the whole cell clickable you probably should add "cursor: pointer;" to the td.menuon style... :)

dauvm
10-26-2002, 03:32 AM
hey ionsurge... I just took a look at your page in Opera... it didn't work. I think it is because you have so many internal style sheets defined. If possibly you should consolidate them all into your top one. The menu background change doesn't work specifically because you have the style sheet in in the body section of your document.

Let me know when you change that and I'll take another look... the code you used should work if put in the right place.

-Doug

ionsurge
10-26-2002, 04:18 PM
Okay, I am sorting everything out now, that has been suggested since my last post, so I will post another reply to this thread when I think I have sorted everything - well almost everything that I can.

Cheers!


Ionsurge.

ionsurge
10-26-2002, 04:35 PM
Okay, I have sorted out the clickable cells, and no I am seeing what will happen with Opera.


Ionsurge.

dauvm
10-26-2002, 09:24 PM
hey Ionsurge,

I don't know if you're going to like me after this :P but I just checked out your page again, and dove a little deeper into the code. I was going to try fixing some things for you, but I realized, your code is (at least from a standards coding person's point of view) really messy.

I looked at your page in IE 5.5, and I have to say I really like your design! But since you appear to have some design and other computer tutorials, you might be interested in how it renders on more than IE.

Here are just a few examples:

- Your Doctype Declaration HAS to be the first line, unless you're using XML, which you're not.
- Your meta tags are written incorrectly, you have:
<meta description="Your ultimate advert and popup free resource."> which should be
<meta name="description" content="Your ultimate advert and popup free resource.">
- You have 1 external style sheet and 3 internal style sheet, one of which isn't in the head section.
- You're using deprecated tags even for HTML 4, for instance bordercolor="#" does not even exist, and you are relying on it for a HUGE amount of your visual effect. using style="border:1px solid #afd5ec" would be a much better alternative.

Well those are just a few specific examples, but here's my strong suggestion to you and anyone else that reads this. Think seriously about using the w3c validator. If you can code your pages to look right, and validate, it will look right on anything else. My personal tactic is to always code for the strictest browser I have (Opera) and then from there I may have to add only one or two lines to make things perfect in IE also... this is much easier than writing for IE, which will accept anything, and then being forced to recode the whole page when you get a number of complaints from your visitors... and your page looks like you're trying to get a lot of visitors.

I hope this helps, at least a little bit.

-Doug

ionsurge
10-27-2002, 08:42 AM
Hey Doug,

I will sort out all those problems, and I am not one to dislike another for making comments to improve my work. I welcome it with open arms, and I look up to you for that, because you are guiding me to make my site better, and run better for all those that will view it. So thank you.

It is now just past 7 am, so I will start on it in a few hours time.

By the way, I was going to download Opera, but it turns out that you have to pay for it, so I was sort of turned away from it. But, seeing as there are people that use it, I will sort it out, and download it.

By the way, I used Dreamweaver MX, which generated all the meta tags, and w3c validators, and I have not touched it since I started, apart from adding my own descriptions. Anyhow, that will be fixed too.

Cheers.


Ionsurge.

dauvm
10-28-2002, 05:03 AM
I'm glad you found my message helpful, ionsurge. I have been writing HTML since I was like... 11 I think, but within the last few months I discovered web standards and felt it was important enough to do a 180 in my way of thinking about coding... and write xhtml and learn CSS from scratch. Some people don't want to hear about any of that stuff because they're not willing to put the time into it, but I'm very glad to see that you're willing to at least look into something different that may help advance your coding too :)

If you need to help finding resourses, I have booked just about every single page that I found helpful in learning the new stuff... one that I think you may enjoy reading is one that perstains to dreamweaver MX.
http://www.webstandards.org/act/campaign/dwtf/
this group is dedicated to corresponding w/ macromedia and changing their dreamweaver to write standards compliant code. That way it won't make silly mistakes like yours did hehe...

Have a nice day!

-Doug



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum