J
JEgbert
I am trying to hide a layer when a text box length is zero, and its
just not working! It hides the content in the layer, but you still
see a little 2 pixel width blip on the screen. I've spent hours
playing with stuff, its a brain cramp. Need someone to state the
obvious for me. Heres my code.....
<style type="text/css" media="screen">
#search_suggest {
position: absolute;
background-color: #FFFFFF;
text-align: left;
border: 1px solid #3366CC;
}
</style>
<script language="javascript" type="text/javascript">
function OneStrcZeroLength(thelayer){
if ( document.getElementById('txtSearch').length == 0){
thelayer.style.display='none';
}
}
</script>
<form id="frmSearch">
<input type="text" id="txtSearch" name="txtSearch" alt="Search
Criteria" onkeyup="searchSuggest();"
onkeydown="OneStrcZeroLength(document.getElementById('search_suggest'));"
autocomplete="off" />
<input type="submit" id="cmdSearch" name="cmdSearch" value="Search"
alt="Run Search" /><br />
<div id="search_suggest">
</div>
</form>
As you can see from the code, ONKEYDOWN for textbox "txtSearch", it
calls function OneStrcZeroLength, which then checks to see if
txtSearch has a zero length, and if it does, it tells the layer style
to change to display none.
Which it doesn't do. Ive done numerous things to try to correct this,
but to no avail. Any ideas?
Thanks!
JE
just not working! It hides the content in the layer, but you still
see a little 2 pixel width blip on the screen. I've spent hours
playing with stuff, its a brain cramp. Need someone to state the
obvious for me. Heres my code.....
<style type="text/css" media="screen">
#search_suggest {
position: absolute;
background-color: #FFFFFF;
text-align: left;
border: 1px solid #3366CC;
}
</style>
<script language="javascript" type="text/javascript">
function OneStrcZeroLength(thelayer){
if ( document.getElementById('txtSearch').length == 0){
thelayer.style.display='none';
}
}
</script>
<form id="frmSearch">
<input type="text" id="txtSearch" name="txtSearch" alt="Search
Criteria" onkeyup="searchSuggest();"
onkeydown="OneStrcZeroLength(document.getElementById('search_suggest'));"
autocomplete="off" />
<input type="submit" id="cmdSearch" name="cmdSearch" value="Search"
alt="Run Search" /><br />
<div id="search_suggest">
</div>
</form>
As you can see from the code, ONKEYDOWN for textbox "txtSearch", it
calls function OneStrcZeroLength, which then checks to see if
txtSearch has a zero length, and if it does, it tells the layer style
to change to display none.
Which it doesn't do. Ive done numerous things to try to correct this,
but to no avail. Any ideas?
Thanks!
JE