wrote:
> I have a couple of different webpages that need to call a function to
> clear the textbox onFocus of the textbox.
whatever.js:
function clrTxt(oElem, oEvent) {
if (
oElem
&& oElem.value
&& oElem.defaultValue
&& oEvent
&& oEvent.type
) {
if (
oEvent.type == "focus"
&& oElem.value == oElem.defaultValue
) {
oElem.value = "";
}
else if (
oEvent.type == "blur"
&& oElem.value == ""
) {
oElem.value = oElem.defaultValue;
}
}
}
whatever.html:
....
<script type="text/javascript" src="whatever.js"></script>
....
<input ...
onfocus="clrTxt(this, event)"
onblur="clrTxt(this, event)"
value="Type Search Here..."
>
....
ciao, dhgm