Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clear_input(element)
- {
- element.value = "";
- element.onfocus = null;
- }
- function restore_default(element)
- {
- if(element.value == '')
- {
- element.value = element.name.substring(0, 1).toUpperCase()
- + element.name.substring(1, element.name.length);
- }
- }
- element.onfocus = "javascript:clear_input(this);";
- element.onfocus = clear_input;
- element.onfocus = function () {
- clear_input( param, param2 );
- };
- function clear_input () {
- this.value = "";
- this.onfocus = null;
- }
- function trim(str) {
- return str.replace(/^ss*/, '').replace(/ss*$/, '');
- }
- function capitalize(str) {
- return str.substr(0, 1).toUpperCase() + str.substr(1).toLowerCase();
- }
- function clear_default(element) {
- if (trim(element.value) == element.defaultValue ) { element.value = ""; }
- }
- function restore_default(element) {
- if (!trim(element.value).length) { element.value = element.defaultValue;}
- }
- function hightlight_input(element) {
- element.select();
- }
- function restore_default(element) // optional, do we restore if the user deletes?
- {
- if(element.value == '')
- {
- element.value = element.name.substring(0, 1).toUpperCase()
- + element.name.substring(1, element.name.length);
- }
- }
- <!-- JavaScript
- function checkClear(A,B){if(arguments[2]){A=arguments[1];B=arguments[2]} if(A.value==B){A.value=""} else if(A.value==""){A.value="Search"}}
- //-->
- <form method="post" action="search.php">
- <input type="submit" name="1">
- <input type="text" name="srh" Value="Search" onfocus="checkClear(this,'Search')" onblur="checkClear(this,' ')">
- </form>
Add Comment
Please, Sign In to add comment