By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,581 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,581 IT Pros & Developers. It's quick & easy.

<UL> and onClick in non-text area of <LI> item

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Randall Sell wrote:
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>


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

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.