web/wp-content/themes/IRI-Theme/js/functions.js
author hurons@caf4f556-3d62-0410-8435-a86758001935
Mon, 01 Feb 2010 09:53:45 +0000
branchwordpress
changeset 124 5cb854c0ff5a
parent 109 03b0d1493584
permissions -rw-r--r--
clean other things

/************************************************************
 ** Clears a field
 ** By: 	Joshua Sowin (fireandknowledge.org)
 ** HTML: <input type="text" value="Search" name="search"
 **			id="search" size="25" 
 ** 		onFocus="clearInput('search', 'Search')" 
 ** 		onBlur="clearInput('search', 'Search')" />
 ***********************************************************/
function clearInput(field_id, term_to_clear) {
	
	// Clear input if it matches default value
	if (document.getElementById(field_id).value == term_to_clear ) {
		document.getElementById(field_id).value = '';
	}
	
	// If the value is blank, then put back term
	else if (document.getElementById(field_id).value == '' ) {
		document.getElementById(field_id).value = term_to_clear;
	}
} // end clearSearch()