网页中禁止右键,禁止f12,禁止ctrl+s等
<script>
document.onkeydown = function(event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e.keyCode === 67 || e.keyCode === 86 || e.keyCode === 13) return true;
if ((e.keyCode === 123) || (e.ctrlKey) || (e.ctrlKey) && (e.keyCode === 85)) {
return false
}
};
// 禁止右键
document.oncontextmenu = function(event) {
return false
};
</script>
js根据name属性动态删除div
html部分
<a href="JAVAscript:del('reducedLine','mlt24',0)">删除</a>
<div id="reducedLine">
<div name="mlt24">1</div>
<div name="mlt24">2</div>
<div name="mlt24">3</div>
<div name="mlt24">4</div>
</div>
js部分
function del(a,b,c){
var removeObj = document.getElementById(a).children[b][c];
removeObj.parentNode.removeChild(removeObj);
}