问题:在表单中不希望密码是复制粘贴上去的
解决:使用jquery的copy cut paste事件
方法:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<title>jquery实现密码不能复制粘贴功能</title>
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("input:text").bind("copy cut paste",function(e){
setTimeout(aa,1000);
});
function aa(){
console.log($("#a").val());
};
})
</script>
</head>
<body>
<p>输入密码: <input id='a' type="text"/></p>
<p>再次输入密码: <input id="b" type="text"/></p>
</body>
</html>
分类 "JavaScript" 下的文章
问题:javascript下正则表达式如何写
解决:使用new RegExp()方法
方法:
var str = "fdsfdsgMfdoFafdflrAemmvclxovcx";
str1 = str.replace('f', 'F'); // 将str字符串中的第一个‘f’换成‘F’
str2 = str.replace(/f/g, 'F'); // 将str字符串中的‘f’全部换成‘F’
var m = 'm';
var reg = new RegExp(m, 'gi');
str3 = str.replace(reg, 'GOOD'); // 根据字符串m的需要,将str字符串中的‘m’或‘M’不区分大小写全部换成‘GOOD’
问题:使用umeditor时滚动页面不希望上面的工具条toolbar固定,希望取消fixed
解决:修改umeditor中的配置文件
方法:
在umeditor.config.js中有toolbar的配置
//autoFloatEnabled
//是否保持toolbar的位置不动,默认true
//,autoFloatEnabled:true
取消上面一行注释,改成false就行了
问题:在python后台如何获取websocket的send方法传递的消息
解决:
后台的on_message()方法就是为了获取websocket传递的消息的,而不是在on_open()方法中使用self.get_argument()或self.request
问题:jquery监听文件框内容变化,屏蔽一些敏感词
解决:使用js的oninput事件
方法:
<input id="name" type="text" oninput="func(this)" />
或jquery方法
$('#name').on('input', function(){
console.log(111);
});