Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 09:27 PM
Randall Sell
Guest
 
Posts: n/a
Default <UL> and onClick in non-text area of <LI> item

OK, I am utterly stumped. The code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
ul {
background-color: red;
}
</head>
</style>
<body>
<table>
<tr>
<td></td> <!-- remove this line and below works?!?! -->
<td>
<ul style="cursor: wait;" onClick="alert('got ya!')">
<li>data</li>
<li>stuff</li>
<li>some more data goes here</li>
</ul>
</td>
</tr>
</table>
</body>
</html>

With the code above, you MUST click on the text in the <UL> list in order to
trigger the onClick() code. If you take out the commented line above (the
<td></td> above) you can then click on any of the red area to trigger the
onClick() code. In the first case you must click on the text. In the second
case, you can click anywhere within the bounds of the <LI> (which is what I
want). WHY?!?!

Both IE 6 and NN7 display the same behaviour. If anyone can explain this I'd
be most grateful. I've beat my head against a wall now for hours and need
help.

ta
-randall


  #2  
Old July 20th, 2005, 09:28 PM
Brian
Guest
 
Posts: n/a
Default Re: <UL> and onClick in non-text area of <LI> item

Randall Sell wrote:[color=blue]
> OK, I am utterly stumped. The code:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <style type="text/css">
> ul {
> background-color: red;
> }
> </head>
> </style>[/color]

misplaced closing style tag, resulting in error; use

</style>
</head>

Fix that. Retry. Note that a validator can help you spot mis-nested
elements and other syntax errors.

http://validator.w3.org/

If you still have problems after that, please put up an online test
and give us the url. (It is much easier to check out an online
example than to starte at code in a post.)

--
Brian
follow the directions in my address to email me

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles