PDA

View Full Version : a couple of web designs questions


mountainman
04-29-04, 10:26 AM
Hey guys:

There are a couple of things I would like to do with my site, but I can't seem to find the code to do it. They shouldn't be too hard, but I just ran out of places to look.

1) I would like there to be a table with 5 cells. Each cell has a word in it that would be like "home", "links, "contact", "photos", and "search". Now, when you mouse over the CELL, the cell with turn a different color. When you click anywhere in the cell, it will take you to that URL. Does this make sense? It isn't real hard, I just don't know how to do it. I do not want to just select the text in the cell, I want to use the whole cell. Basically, I want to avoid making tons of little graphics in different colors with different words. That is too time consuming.

2) This kind of builds on #1. Once they click on the "search" cell and go to the search page, I would like the cell that says "search" to stay a certain color. For instance, if all cells are blue by default, you go mouseOver and the cell turns red. When you click it, and go to that page, that cell stays red while you're on that page.

If anyone can help me with this, I would greatly appreciate it. I don't know PHP, ASP or anything like that. I assume there has to be some HTML or JS that does this. I just ran out of Google search words. LOL I thinK I am just not calling it the correct thing.

Thanks a ton!

:)

TonyT
04-30-04, 06:48 AM
Easily done using CSS:

<head>
<style>
.over { background-color:pink; }
.out { background-color:red; }
</style>
</head>

<body>
<table>
<tr style="background:red;">
<td onmouseover="this.className='over'" onmouseout="this.className='out'"></td>
</tr>
</table>
</body>

many more here (http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=css+onmouseover+table+cell+colors)

mountainman
04-30-04, 07:31 AM
Dang, Tony. You are the man.

Congrats again on the MVP award. You and Norm truely deserve it.

:thumb:

TonyT
04-30-04, 09:13 AM
no problemo!

When using such mouseover effects, it's best to kep the code as simple as possible and even avoid javascript if possible, that way the pages are faster, no security settings conflicts and efficiency is attained.

Sometimes though, javascript is necessary (DHTML) so as to have code comply with all browsers.