DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > General DHTML issues
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 22.07.2006, 12:03
sysop8910 sysop8910 is offline
Neuer Benutzer
 
Join Date: 22.07.2006
Location:
Posts: 1
Default

I'm trying to create a drop-down button...

[code:92t9638hus]<div class="drop_button">
<div class="button">
<input type="button" class="default" value="Create New"><input type="button" class="options"

onclick="this.parentNode.parentNode.getElementsByT agName('ul')[0].style.display=

(this.parentNode.parentNode.getElementsByTagName(' ul')[0].style.display=='') ? 'none' : '';"

onblur="setTimeout('document.getElementById(\'yyy\ ').style.display=\'none\';', 200)">
</div>
<ul id="yyy" class="dropdown" style="display:none">[*]abc[*]defgh[/list]</div>

<style>

.drop_button {
float:left;
margin:0 2px;
}


.drop_button .button input {
background-color:#99c1bb;
border-left: 1px solid #eeeeee;
border-top: 1px solid #eeeeee;
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
font-family: Tahoma, Verdana, Arial;
font-size: 12px;
}

.drop_button .button input.options {
width:12px;
}

.drop_button .button input.options {
width:15px;
padding: 0px;
margin: 0px;

background-image: url(downarrow.gif);
background-repeat: no-repeat;
background-position: center;
}

.drop_button ul.dropdown {
padding:0px;
margin:0px;
width:130px;
list-style-type: none;
position:absolute;
background-color: #cccccc;
}

.drop_button ul.dropdown li {
border: 1px solid black;
padding:0px;
margin:0px;
}

.drop_button ul.dropdown li a {
display:block;
padding:2px;
margin:0px;
text-decoration: none;
color: #000000;
font-family: Tahoma, Verdana, Arial;
font-size: 12px;
}

.drop_button ul.dropdown li a:hover {
background-color: #00ffff;
}

* html .drop_button ul.dropdown li a {
width:150px;
w\idth:129px;
}

</style>
[/code:92t9638hus]

There are two issues with this... The first one was that the onblur event happened before the link could be processed...so I added a setTimeout for 200 milliseconds to allow the link to be processed. It works fine, but I don't want to use an arbitrary ID "yyy" to grab the object. I would prefer not doing this...in fact I would prefer not doing the setTimeout at all. The point of this piece of code is to be self-contained...no external code, just drop it in and it works. So no initialization functions or whatnot. Is there any way of doing this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump

All times are GMT +2. The time now is 13:41.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.