当前位置:网站首页>JS - mouse and keyboard configuration and browser forbidden operation
JS - mouse and keyboard configuration and browser forbidden operation
2022-07-24 06:38:00 【Jie_ one thousand nine hundred and ninety-seven】
JS - Mouse and keyboard configuration And The browser prohibits operation
One . Definition DOM Middle mouse pointer style
<script type="text/javascript">
window.onload=function(){
// obtain dom Elements
var dom = document.getElementsByClassName("page")[0];
// css form , Modify the mouse pointer style
dom.style.cursor = 'pointer';
}
</script>
More styles :
| Pointer style | attribute |
|---|---|
| Default arrow | cursor : default |
| Hand shape | cursor : pointer |
| Move the cross arrow | cursor : move |
| Help question mark | cursor : help |
| Cross center | cursor : crosshair |
| written words / edit | cursor : text |
| Can't release ( Ban ) | cursor : no-drop |
| Ban | cursor : not-allowed |
| Automatically | cursor : auto |
| In processing | cursor : progress |
| Change size up | cursor : n-resize |
| Change size down | cursor : s-resize |
| Change size to the left | cursor : w-resize |
| Change size to the right | cursor : e-resize |
| Change size up and left | cursor : nw-resize |
| Change size down and left | cursor : sw-resize |
| Change size up and right | cursor : ne-resize |
| Change size down and right | cursor : se-resize |
Two . Definition DOM Middle mouse move in 、 Removal method
- Mouse in :
onmouseover="mOver(this)- Mouse removal :
onmouseout="mOut(this)- The method here is : Change text size
<div class="page" onmouseover="mOver(this);" onmouseout="mOut(this);">Hello, Hello !</div>
<script type="text/javascript">
// Move the mouse pointer into
function mOver(evt){
evt.style.fontSize = '20px'; // Adjust the font size to 20px
}
// The mouse pointer moves out
function mOut(evt){
evt.style.fontSize = ''; // Adjust the font size to the default
}
</script>
3、 ... and . Disable right mouse button
<script type="text/javascript">
document.oncontextmenu = function(){
event.returnValue = false;
}
// Or return the whole event directly
document.oncontextmenu = function(){
return false;
}
</script>
Four . It is forbidden to select
- Appoint DOM
onselectstart="return false"<div class="page" onselectstart="return false">Hello, Hello !</div> - The whole page
<script type="text/javascript"> document.onselectstart = function(){ event.returnValue = false; } // Or return the whole event directly document.onselectstart = function(){ return false; } </script>
5、 ... and . Prohibit copying
- Appoint DOM
oncopy="return false"oncut="return false"<div class="page" oncopy="return false" oncut="return false">Hello, Hello !</div> - The whole page
<script type="text/javascript"> document.oncopy = function(){ event.returnValue = false; } // Or return the whole event directly document.oncopy = function(){ return false; } </script>
6、 ... and . Do not paste
onpaste="return false"
<div class="page" >Hello, Hello !</div>
<input type="text" onpaste="return false" />
7、 ... and . Disable keyboard F12 event
<script type="text/javascript">
document.onkeydown=function (e){
var currKey=0,evt=e||window.event;
currKey=evt.keyCode||evt.which||evt.charCode;
if (currKey == 123) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
</script>
边栏推荐
- Summary browser object
- A batch of interview questions and answers_ 20180403 latest arrangement
- API流程和代码结构
- PXE technology network installation
- Leetcode sword finger offer jz23: the entry node of the link in the linked list
- Flink time stream processing
- 实验:LVM逻辑卷的建立、扩容、与删除
- Flex layout
- Polkadot | interprets how liberty plan, which subverts traditional social media, will be launched in Poka
- go的环境搭建和起步
猜你喜欢
随机推荐
MySQL batch modifies the data table code and character set to utf8mb4
Talk about strong cache and negotiation cache
sql server 同步数据库 跨网段无公网ip几个常见小问题问题
Write blog at leisure ~ briefly talk about let, VaR and Const
go的环境搭建和起步
Unable to boot after permanent mounting
Sed command
object-oriented
The character that appears the most times in the JS output string
使用自定义zabbix包(4.0.5版本)安装agent和proxy
Transition effect
RESTful API介绍
账号和权限管理
LVM与磁盘配额
grep与正则的搭配使用
Write cookies, sessionstorage, localstorage and session at will
今天聊赖数据库MySQL底层架构设计,你了解多少?
MySQL Index & execution plan
[301] grotesque behavior - predictable irrationality
文件系统与日志分析









