Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doubly opening link problem

Status
Not open for further replies.

mgriffith

MIS
Jul 3, 2001
177
US
i have my navigation set up so that an ie user can click on either the cell that the link is in or the link to open the link. my problem is that when the person clicks on the link, the browser responds by opening the link from the cell AND the link from the link (if that makes any sense). is there a way to somehow disable the cell link if the user clicks directly on the link? here is a little snippet for clarification.


<td id=&quot;id9&quot; class=&quot;MenuItem&quot; onclick=&quot;window.open('default.xml')&quot; onmouseover=&quot;rollon(this)&quot; onmouseout=&quot;rolloff(this)&quot;>
<a href=&quot;default.xml&quot; target=&quot;_blank&quot; onmouseover=&quot;rollon('id9')&quot; onmouseout=&quot;rolloff('id9')&quot;>
Homepage
</a>
</td>
 
Hi,

Try this:
(the style=&quot;cursor:hand&quot; is to make your whole cell look like a link, but you better add this part to your class=menuItem)


<td id=&quot;id9&quot; style=&quot;cursor:hand&quot; class=&quot;MenuItem&quot; onclick=&quot;window.open('default.xml')&quot; onmouseover=&quot;rollon(this)&quot; onmouseout=&quot;rolloff(this)&quot;>
<a href=&quot;#&quot; onclick=&quot;javascript: return false&quot; target=&quot;_blank&quot; onmouseover=&quot;rollon('id9')&quot; onmouseout=&quot;rolloff('id9')&quot;>
Homepage
</a>
</td>

Hope this helps,
Erik
 
the cursor is included in the style definition for the menuitem class...the reason i had the link in the <a href> was for compatibility with netscape...it needs to stay...that's my problem
 
I can not test NN here but maybe this will work in NN?

<a href=&quot;default.xml&quot; onclick=&quot;javascript: return false&quot; ....

Erik
 
it works with ie, but netscape can't open anything....but i can fix that...i'll just add an if document.all{//ie code}....thanks
 
The reason why the link is opened twice when clicking on the link is that for IE, the event 'bubbles up' through the hierarchy of containing elements. You can stop this behaviour for an event using:
Code:
onClick=&quot;window.open(....); cancelBubble = true;&quot;
Hope this helps, Cheers Neil :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top