• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Anchor within anchors

I was wondering if this is possible,

<a href='page1.html'> Page 1
   <table><tr><td><a href='page2.html'> Page 2 </a></td></tr></table>
</a>

I need this to work since I have this menu system built using CSS. However, when I hover over the second page the status bar still says page1.html. If I click the second link then it gives me page2.html in IE, but page1.html in Netscape?

I have to keep this structure. Any suggestions on how to make this work (preferably without using any javascript). If I get a good quick answer, I'll increase the points for the person.

Thanks

AJ
0
aratani
Asked:
aratani
  • 3
  • 3
  • 2
1 Solution
 
DaydreamsCommented:
Hi aratani,

You need to close the anchor tags properly:

<a href="page1.html"> Page 1</a>
   <table><tr><td><a href="page2.html"> Page 2 </a></td></tr></table>
0
 
neesterCommented:
No that is not possible.
you cannot have a block elemtnt like a table, inside an inline element like an anchor.

Basically - No you cant.
I am guessing you want a hover effect when you hover over the table?
Using CSS, this can be done:

table:hover
{
CODE HERE
}
0
 
neesterCommented:
Sorry I just realise how much that didn't make sense.

No You cannot have your code structured like that.
A table is a BLOCK level element.
Which cannot reside inside an INLINE element.
An Anchor is an INLINE element.

Your code is invalid HTML, and will produce unsavoury results in most browsers.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
arataniAuthor Commented:
Well, the menu system right now works perfectly. Actually, the table within the anchor do show up as a table in all the browsers I've tested. :). But, I can't get the link in Page2 to connect. It still thinks we are in the anchor for Page1. I was just wondering if there was a way to get the link in Page2 to work.

AJ
0
 
DaydreamsCommented:
>It still thinks we are in the anchor for Page1.

It is because you closed the a tag after the table. As Neester said, it is invalid code.
0
 
arataniAuthor Commented:
Okay, I get that. But, now I have a newer problem and I don't know if I can ask that up here. But, to make my menu's work, I have used the hover element. However, the hover doesn't work for IE (for anything except the anchor tag). Is there someone who can give me a way to make the hover work for IE.

For example,

<span class='menu'><a href='page1.html'> Page 1 </a>
   <table><tr><td><a href='page2.html'> Page 2 </a></td></tr></table>
</span>

The style sheet is,

span.menu:hover {

 
}

This works for Mozilla and Netscape, but not for IE.

Can someone tell me how to make it work for IE? I will reward them with points.

Thanks

AJ
0
 
DaydreamsCommented:
Hi aratani,

You can't put a block level element like a table inside a span tag. I don't see the necessity of the table, but you could put the links in td's if you like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
a.menu:hover {background-color:#ff0000; }  /*for example*/
</style>
</head>
<body>
<table><tr><td>
<a class="menu" href="page1.html"> Page 1 </a></td>
<td><a class="menu" href="page2.html"> Page 2 </a></td>
</tr>
</table>
</body>
</html>
0
 
neesterCommented:
YES you can make it work with a LITTLE javascript code.
Look at this website:

http://www.htmldog.com/articles/suckerfish/dropdowns/

You wont need to HACK it up with invalid code etc...

Look at these example pages:
http://www.htmldog.com/articles/suckerfish/dropdowns/example/
http://www.htmldog.com/articles/suckerfish/dropdowns/example/vertical.html

Very easy to adapt to any website!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now