Hello,
I need your help.
I can't seem to quite figure out so as to add an onblur event to my css div only selectbox.
The normal onblur method for my wrapper div is not working:
Code:<!DOCTYPE html> <html> <head> <style type="text/css"> #container { width: 200px; float: left; font-family: Arial; font-size: 10pt; position:relative; } #one { height: 200px; border: 1px solid red; display: none; position:absolute; background: #C0C0C0; } #two { width: 8px; height: 8px; float: left; position:absolute; } #commentsbox, ul { list-style: none; margin: 0; cursor: default; width:194px; padding:6px; } #commentsbox, ul, li { padding: 2px; } #commentsbox li:hover{ background: blue; color: #fff; } #result { border: 1px solid #000; width: 206px; } </style> <script type="text/javascript"> function showcommentsbox(){ document.getElementById("one").style.display="block"; } function hidecommentsbox(){ document.getElementById("one").style.display="none"; } // pick a name that's useful to you: function textToTextArea (e) { e = e ? e : event; var text = e.target ? e.target : e.srcElement; document.getElementById('result').innerHTML = text.innerText } </script> </head> <body> <div id="container"> <div id="one" onclick="hidecommentsbox()"> <ul onclick="textToTextArea(event)" id="commentsbox" onblur="hidecommentsbox()"> <li>Item 1</li> <li>Item 2</li> </ul> </div> </div> <div id="two"><img src="images/arrow_double.png" onclick="showcommentsbox()"></div> <br> <textarea id="result"></textarea> </body> </html>



Reply With Quote



Bookmarks