I have a little text editor that is a search box. I want it to say (Search for items here) until someone clicks in the box or it contains text they have typed. I have 2 Client Side Events defined in Javascript and on the control. OnFocus and OnBlur. Below is the JScript code but it is not working. I actually get a little "Page has errors" with a sytax error icon. Any help would be appreciated:
<script type="text/javascript" id="igClientScript"><!--
function ClearText(oEdit, text, oEvent){
var obj = document.getElementById("txtSearch"); obj.value = ""; obj.style.font-style = "normal"; obj.style.color = "black";
}
function ResetNULLText(oEdit, text, oEvent){ var obj = document.getElementById("txtSearch");
if(obj.value == "") { obj.value = "(Search for items here)"; obj.style.font-style = "italics"; obj.style.color = "#666666"; } }// --></script>
Here is the correct way to do this. Took a while to find the documentation on it.
oEdit.setValue(""); //oEdit.style.font-style = "normal"; //oEdit.style.color = "black";
function ResetNULLText(oEdit, text, oEvent){ if(oEdit.getValue() == "") { oEdit.setValue("(Search for items here)"); //oEdit.style.font-style = "italics"; //oEdit.style.color = "#666666"; } }// --></script> Now I have to work on setting the style.