I noticed that the onblur for the close doesn't work for Chrome and Safari (applewebkit's problem?), so here is code that puts a "Close [x]" button at the top:
Code:
<script type="text/javascript">
var myArr = ["1", "2", "3", "4", "5", "6", "7"];
var urArr = ["Monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
var dropList = function(me, arr){
var offset = [me.offsetLeft, me.offsetTop];
var dropDown = document.createElement("ul");
dropDown.style.position = "absolute";
dropDown.style.left = offset[0];
dropDown.style.top = offset[1];
var close = document.createElement("li");
var closeLink = document.createElement("a");
closeLink.href = "javascript: void(0);";
closeLink.onclick = function(){
document.body.removeChild(dropDown);
}
var closeText = document.createTextNode("[x] Close");
dropDown.appendChild(close);
close.appendChild(closeLink);
closeLink.appendChild(closeText);
for(x in arr){
var child = document.createElement("li");
var childText = document.createTextNode(arr[x]);
dropDown.appendChild(child);
child.appendChild(childText);
}
document.body.appendChild(dropDown);
var a = true;
me.onblur = function(){
document.body.removeChild(dropDown);
};
};
</script>
<input type="button" onclick="dropList(this, urArr);" value="Day"/><input type="button" onclick="dropList(this, myArr);" value="Number?"/>
It seems your topic is solved... Please set the status to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Bookmarks