Making table datas clickable...

windows

Guest
Greetings!<br />
<br />
I have a menu in a few tables, heavily modified with style sheets and with a onMouseover and onMouseout on them which highlights a menu selection.<br />
<br />
However, you still need to aim at the text in order to be able to click and follow a link (since I don't have a onMouseclick in the data and the link is a simple href on the text).<br />
<br />
The reason for me doing this is that I need to minimize the places people have to make modifications to when they want to add anything (people without any knowledge of html are going to mess with the page).<br />
<br />
My question now is this:<br />
<br />
Is there some way to enable clicking on the table data to follow the link in it?<br />
<br />
(Note that I do not want to have multiple hrefs or classes which places links away from the text or anything which might complicate any modifications to the page...)<br />
<br />
Sincerely, Robert<!--content-->Mmmm, I'm a bit confused. Do you have a URL you could post so I could have a look?<br />
<br />
Or failing that, some code?<br />
<br />
Thanks<!--content-->Sorry, the website is on an intranet, but I do have some code and maybe a better description:<br />
<br />
Current menu item looks like this:<br />
<br />
<tr><td onMouseover="this.style.backgroundColor='#ffffdf'" onMouseout="this.style.backgroundColor='#d5d9df'"><br />
<a href=http://www.htmlforums.com/archive/index.php/"handbooks/sdp/" target="main">SDP</a><br />
</td></tr><br />
<br />
Notice how the line with the link stands "alone" and without any strange html/script mumbo-jumbo.<br />
<br />
My dream-scenario is now this: I'd like to add something to the <td> tag which will make it clickable and take me to the same url as the <a href> line... BUT I don't want the url on two places AND I don't want to mess with the <a href> line!<br />
<br />
Did that help?<br />
<br />
/Robert<br />
<br />
Ps. everything is heavily styled with stylesheets, including <a> and <td>...<!--content-->So, are you saying that in a sense you want to apply the clickable link to the whole table cell rather than just the text so that it affects whatever content is put into the cell?<br />
<br />
I'm afraid that this sounds as though it is beyond the boundaries of my knowledge. I'm not saying it's impossible though.<br />
<br />
If I've still got the wrong end of the stick, let me know and I'll have another go at solving it!<br />
<br />
Sorry I can't be of more help.<!--content-->Thank you for a short and clear description for what I was trying to say (English is not my naitive language).<br />
<br />
That is exactly what I am trying to do!<br />
<br />
I know how to do it with classes and onMouseclicks in javascript, but that would be too complicated for other people than me to edit (since the html would get cluttered).<br />
<br />
Anyway, thanks for taking time to try to solve this. Maybe someone else has noticed this thread now and can help?<br />
<br />
/Robert<!--content-->You're welcome! ;) Although I honestly don't think it can be done without using JavaScript or something else. I'm almost certain you can't do it with just HTML.<br />
<br />
But good luck anyway!<br />
<br />
Goldi<!--content-->Wouldn't this work with a slice?<br />
<br />
Can't you just put it into Dreamweaver<br />
and slice that area?<!--content-->Slicing is fine when you are working with images but as far as I know you can't slice HTML pages and tables.<!--content-->I've seen this question before and don't remember if it ever got solved. the only thing I can suggest is using a small gif that fills the cell and just make it a link.<!--content-->But I don't think they want images in the cell. I think they want others to be able to enter text and have the link applied to whatever they enter.<!--content-->I totally misunderstood that one. I thought he had a table cell with a text link and wanted the whole cell that link. if they have to type it in then it is not a text link, it would be a textbox link. so do they type it in or is it already a text link.<br />
<br />
I thought he said a menu, my bad :D<!--content-->Try this (but not in Netscape!):<br />
<br />
<tr><td onMouseover="this.style.backgroundColor='#ffffdf'"onMouseout="this.style.backgroundColor='#d5d9df'"<br />
onclick="redirect(this)"> <br />
<a href=http://www.htmlforums.com/archive/index.php/"handbooks/sdp/" target="main">SDP</a> <br />
</td></tr> <br />
<br />
function redirect(obj) {<br />
var kids = obj.children;<br />
if (!kids || !kids.length) return false;<br />
for (var i=0; i< kids.length; i++) {<br />
if (kids.tagName == "A") kids.click();<br />
}<br />
return true;<br />
}<!--content-->strange... this works, but not in netscape. Also the mouse doesn;t change onMouseover (the color does).....and the link is valid.<br />
<br />
<br />
<table border=1><br />
<tr><br />
<td>not me!</td><A href=http://www.htmlforums.com/archive/index.php/"http://www.yahoo.com"><td onMouseover="this.style.backgroundColor='#cc0000'"onMouseout="this.style.backgroundColor='#d5d9df'" <br />
>ME ME ME!!!</td></a><td>not me either</td><br />
</tr></table><!--content-->Interestnig!<br />
<br />
Thank you for your replies!<br />
<br />
I'm not sure you are supposed to be able to put a <a> tag around a <td> ...have to look into that.<br />
<br />
But that script sure looks nice!<br />
<br />
But I probably will use match or search instead of for-loops... :)<br />
<br />
Thanks again!<br />
<br />
/Robert<!--content-->es, I know your not SUPPOSED to do it, but it works anyway.<!--content-->try looking at dynamicdrive.com - im pretty sure you will find something there, maybe in the navigation and menus section or whatever it is called.<!--content-->
 
Back
Top