HighDots Forums  

cross-browser <UL> SELECT list - any ideas?

alt.html.dhtml alt.html.dhtml


Discuss cross-browser <UL> SELECT list - any ideas? in the alt.html.dhtml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Michaels
 
Posts: n/a

Default cross-browser <UL> SELECT list - any ideas? - 03-02-2006 , 09:13 PM






From what I can guess, this is not cross-browser. am I correct? IE-only?
what *would* be cross-browser, without resorting to the un-debugged AJAX
code I saw?
There's more I can do with this code. it came from a book that is
suspiciously IE-only.

<style>
..list {
cursor:hand;
overflow:auto;
width:150pt;
height:75pt;
border:1pt black solid;
}
..list UL {
list-style-type: none;
margin-left:2pt;
margin-top:0pt;
margin-bottom:0pt;
}
..list UL LI {
margin-top:0pt;
margin-bottom:0pt;
}
..list UL LI.selected {
background:navy;
color:white;
}
</style>
<script>
function checkParent(src,tag) {
while ("HTML" != src.tagName) {
if (tag == src.tagName) {
return src;
}
src=src.parentElement;
}
return null;
}
function selectItem(list) {
var el=checkParent(event.srcElement,"LI");
if ("LI"==el.tagName) {
if (null != list.selected) list.selected.className="";
if (list.selected != el) {
el.className="selected";
list.selected=el;
//do something here
} else list.selected=null;
}
}
<script>

<div class="list">
<ul id="src" onclick="selectItem(this);">
<li><img src="i/img1.jpg" /></li>
<li><img src="i/img2.jpg" /></li>
<li><strong>hi there</strong></li>
<li>click me</li>
</ul>
</div>



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.