I\'m allowing a user to use either one of two textboxes to search a database - one is an ID field, and one is a freetext field. I\'m using ASP.NET with C# btw.
Anyway, a
Given a function in javascript:
function clearOther(which){ document.getElementById(which).value=''; }
this can then be called when you focus on one textbox, passing the id of the other:
working example --> http://jsfiddle.net/CwWKn/