Home >php教程 >php手册 >easyui中propertygrid实现密码显示效果

easyui中propertygrid实现密码显示效果

WBOY
WBOYOriginal
2016-06-07 11:36:531173browse

实现一个密码显示效果(非明文显示)
效果如下图所示,输入密码后鼠标点击其他地方,显示圆点代替
easyui中propertygrid实现密码显示效果

easyui中propertygrid实现密码显示效果

实现代码如下:

js扩展代码(function($){<br>     /**<br>      * datagrid扩展<br>      */<br>     $.extend($.fn.datagrid.defaults.editors, {<br>         password: {<br>             init: function(container, options){<br>                 return $('<input>').appendTo(container);<br>             },<br>             destroy: function(target){<br>                 $(target).remove();<br>             },<br>             getValue: function(target){<br>                 return $(target).val();<br>             },<br>             setValue: function(target, value){<br>                 $(target).val(value);<br>             },<br>             resize: function(target, width){<br>                 $(target)._outerWidth(width);<br>             }<br>         }<br>     });<br> })(jQuery);初始化 columns = [[<br>     {field: 'name', title: '名称', width: 80, sortable: true},<br>     {field: 'value', title: '参数', width: 200, sortable: false, formatter:function(value, arr){<br>         var editor = '';<br>         if(typeof arr.editor == 'object'){<br>             editor = arr.editor.type;<br>         }else{<br>             editor = arr.editor;<br>         }<br>         switch(editor){<br>             case 'password':<br>                 return value.replace(/./g, '●');<br>                 break;<br> <br>             default:<br>                 return value;<br>         }<br> <br>     }}<br> ]];

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn