web/wp-content/themes/IRI-Theme/js/functions.js
changeset 136 bde1974c263b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/themes/IRI-Theme/js/functions.js	Wed Feb 03 15:37:20 2010 +0000
@@ -0,0 +1,20 @@
+/************************************************************
+ ** 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()
\ No newline at end of file