[ic] onFocus clearing of search field

Barry Treahy, Jr. interchange-users@icdevgroup.org
Wed Jul 17 13:38:00 2002


I seem to be tripping over myself.  What I'm attempting to do is 
extremely simple, that is having a search instruction in the search 
field and clearing it when focus is detected, yet I just be missing 
something and I'm sure it is probably a combination of the various 
browser DOM's and IC.  Here are a couple of the code segments if someone 
has any suggestions or alternatives:

<script LANGUAGE="JavaScript" type="text/javascript">
<!--
function blankbox() {
    document.site_search_form.mv_searchspec[1].value = "";
    return 1;
  }
}
//-->
</script>
                    <form action="[area search]" method=post 
name="site_search_form">
                      <input type=hidden name=mv_session_id value="[data 
session id]">
                      <table border="0" width="95%">
                        <tr>
                          <td align="left">
                            <INPUT TYPE=hidden NAME=mv_coordinate VALUE=1>
                            <INPUT TYPE=hidden NAME=mv_searchtype VALUE=db>
                            <INPUT TYPE=hidden NAME=mv_matchlimit 
VALUE=[control matches 10]>
                            <INPUT TYPE=hidden NAME=mv_sort_field 
VALUE=category>
                            <INPUT TYPE=hidden NAME=mv_search_field 
VALUE="*">
                            <input type=hidden name=mv_substring_match 
value=1>
                            <INPUT TYPE=hidden NAME=mv_column_op VALUE=ne>
                            <INPUT TYPE=hidden NAME=mv_column_op VALUE=rm>
                            <INPUT TYPE=hidden NAME=mv_searchspec VALUE=1>
                            <INPUT size=20 MAXLENGTH=40 
NAME=mv_searchspec type=text size=6 onFocus="blankbox();" value="Enter 
Model or Description">
                          </td>

Also, if you have an alternative that eliminates all JS, I'm open 
ears...  For example, I have seem some sites that maintain the contents 
of the search field as selected so that one a person changes focus to it 
and starts typing, all of the text disappears...

Thanks...

Barry