I'm new to JavaScript, so this might be very easy for a lot of you.
I have a HTML select object with some options in it. The whole SELECT is in a small div. The only thing I like to achieve is to close the div everytime I clock on one of the options. Now, every option does something else, that's no problem. But I can't seem to tell all of them to close this div. Is it somet开发者_如何学Gohing about this.id ??
Thanks
give id to that div...for my example suppose it is 'Div' and try this code...
<form name='template'>
<select name='choise' onchange="javascript:hideDiv()">
<option value="uniquename">uniquename</option>
</select>
</form>
and script code is
function hideDiv(){
if(document.getElementById('Div').style.display != "none") { document.getElementById('Div').style.display = "none"; }}
精彩评论