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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clickable Table question

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Ringing in my ears - "Don't use Tables" - but I have.

I've got a table containing various cells and if the user clicks any part of the table it acts like a link:
Code:
<table style='cursor: hand;' onmouseover="this.bgColor='#FFECD9'" onmouseout="this.bgColor='#FFECB9'" onClick="window.location='bigpage.php?topicid=25'">

However, in one of the cells of the table is a textbox allowing people to leave a comment regarding the content of the table. At the moment they can't enter anything into the textbox because clicking within it triggers the onClick event for the entire table.

Is there a way I can get it so that clicking in the textbox overrides the onClick of the table?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Hi

For standard compliant browsers :
JavaScript:
reference_to_your_textbox_whatever_that_means[teal]=[/teal][b]function[/b][teal]([/teal]e[teal])[/teal] [teal]{[/teal]
  e[teal].[/teal]cancelBubble[teal]=[/teal][b]true[/b]
[teal]}[/teal]
Two words anyway : usability nightmare.


Feherke.
 
Thanks for the help.

Unfortunately I'm relatively new to Javascript and I couldn't figure out how to implement your suggestion so I did it a different way by using a global variable IgnoreClick and setting it to 1 if the textbox is clicked. If it's 0 then the page navigates:
Code:
<SCRIPT language='Javascript'> 
 
  var IgnoreClick=0;
 
  function TileClick(topicID, topicName)
  {
    if (IgnoreClick==0)
    { 
      window.location="bigpage.php?topicid=" + topicID + "&name=" + topicName;
    }
    IgnoreClick=0;
  }
</SCRIPT>

...

<table style='cursor: hand;' onmouseover="this.bgColor='#FFECD9'" onmouseout="this.bgColor='#FFECB9'" onClick="TileClick(22, 'Global+Warming')">

...

<input onClick="IgnoreClick=1;" type='text' maxlength=15 style='font-family: Arial; font-size: 12px;'>

- Andy
___________________________________________________________________
If a man speaks in a forest and there are no women around to hear him - will he still be wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top