diff --git a/application/default/views/scripts/author/metadata-new.phtml b/application/default/views/scripts/author/metadata-new.phtml index 864d7962..f6e11711 100644 --- a/application/default/views/scripts/author/metadata-new.phtml +++ b/application/default/views/scripts/author/metadata-new.phtml @@ -352,49 +352,41 @@ function SelectInputTemplate(name){ } } +(function( $ ){ + + $.fn.inputbg = function( options ) { + + // Create some defaults, extending them with any options that were provided + var settings = $.extend( { + val : '姓名' + }, options); + + this.each(function() { + if($(this).val() == '') + { + $(this).val(options.val); + } + }); + + this.bind('focus',function(){ + if($(this).val() == options.val) + { + $(this).val(''); + } + }); + this.bind('blur',function(){ + if($(this).val() == '') + { + $(this).val(options.val); + } + }); + + }; +})( jQuery ); + function InputTextSet(){ - var def_val_name = "姓名" - var def_dom_name = ".contact_name"; - $(def_dom_name).each(function(index, element) { - if($(this).val() == '') - { - $(this).val(def_val_name); - } - }); - $(def_dom_name).bind('focus',function(){ - if($(this).val() == def_val_name) - { - $(this).val(''); - } - }); - $(def_dom_name).bind('blur',function(){ - if($(this).val() == '') - { - $(this).val(def_val_name); - } - }); - - var def_val_email = "Email" - var def_dom_email = ".contact_email"; - $(def_dom_email).each(function(index, element) { - if($(this).val() == '') - { - $(this).val(def_val_email); - } - }); - $(def_dom_email).bind('focus',function(){ - if($(this).val() == def_val_email) - { - $(this).val(''); - } - }); - $(def_dom_email).bind('blur',function(){ - if($(this).val() == '') - { - $(this).val(def_val_email); - } - }); - + $('.contact_name').inputbg({'val':'姓名'}); + $('.contact_email').inputbg({'val':'Email'}); } // Google Map Part