a标签跳转

<a href="new_link" target="_blank">在新建页面打开链接</a>。
<a href="new_link">在当前页面打开链接</a>。

禁止选中

整个页面
<body onselectstart="return false"> FROM表单标签(标签属性)(无法获取表单属性)
disabled="disabled"
FROM表单标签(标签属性)(可获取表单属性)
readonly="readonly" DIV LI等(标签样式)
style="pointer-events: none;"

禁止修改页面及开启调试模式等(未测试)

<script>
//这段js要放在页面最下方
var h = window.innerHeight,w=window.innerWidth;
//禁用右键 (防止右键查看源代码)
window.οncοntextmenu=function(){return false;}
//在本网页的任何键盘敲击事件都是无效操作 (防止F12和shift+ctrl+i调起开发者工具)
window.onkeydown = window.onkeyup = window.onkeypress = function () {
window.event.returnValue = false;
return false;
}
//如果用户在工具栏调起开发者工具,那么判断浏览器的可视高度和可视宽度是否有改变,如有改变则关闭本页面
window.onresize = function () {
if (h != window.innerHeight||w!=window.innerWidth){
window.close();
window.location = "about:blank";
}
}
/*好吧,你的开发者工具是单独的窗口显示,不会改变原来网页的高度和宽度,
但是你只要修改页面元素我就重新加载一次数据,让你无法修改页面元素(不支持IE9以下浏览器)*/
if(window.addEventListener){
window.addEventListener("DOMCharacterDataModified", function(){window.location.reload();}, true);
window.addEventListener("DOMAttributeNameChanged", function(){window.location.reload();}, true);
window.addEventListener("DOMCharacterDataModified", function(){window.location.reload();}, true);
window.addEventListener("DOMElementNameChanged", function(){window.location.reload();}, true);
window.addEventListener("DOMNodeInserted", function(){window.location.reload();}, true);
window.addEventListener("DOMNodeInsertedIntoDocument", function(){window.location.reload();}, true);
window.addEventListener("DOMNodeRemoved", function(){window.location.reload();}, true);
window.addEventListener("DOMNodeRemovedFromDocument", function(){window.location.reload();}, true);
window.addEventListener("DOMSubtreeModified", function(){window.location.reload();}, true);
}
</script>

同上(未测试)

一、屏蔽F12 审查元素

document.onkeydown = function(){

    if(window.event && window.event.keyCode == ) {
alert("F12被禁用");
event.keyCode=;
event.returnValue=false;
}
if(window.event && window.event.keyCode == ) {
window.event.keyCode = ;
}
if(window.event && window.event.keyCode == ) {
alert(str+"\n请使用Del键进行字符的删除操作!");
window.event.returnValue=false;
} } 除了屏蔽这个,我们还有其他有趣的设置: 二、屏蔽右键菜单
document.oncontextmenu = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
} 三、屏蔽粘贴
document.onpaste = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
} 四、屏蔽复制
document.oncopy = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
} 五、屏蔽剪切
document.oncut = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
} 这种很适合小说网站,毕竟版权珍贵,被别人随意copy走内容就不好了 六、屏蔽选中
document.onselectstart = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
} catch (e) {
return false;
}
}

禁用预先调试

var threshold = ; // 打开控制台的宽或高阈值
// 每秒检查一次
window.setInterval(function() {
if (window.outerWidth - window.innerWidth > threshold ||
window.outerHeight - window.innerHeight > threshold) {
// 如果打开控制台,则刷新页面
window.location.reload();
}
}, 1e3);

快捷判断

{{moneyrecordinfo.totalmoney||0}}
<!-- 前面为true则显示,否则显示后面 -->

文字显示两行,且超出部分隐藏

overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;

文字显示一行,且超出部分隐藏

word-break: keep-all;
/*不换行*/
white-space: nowrap;
/*超出部分隐藏*/
overflow: hidden;
/*多余文字转换省略号*/
text-overflow: ellipsis;
text中划线
text-decoration: line-through;
下划线
text-decoration: underline;
文本居中
text-align: center;

input提示文字

<input placeholder="text" >

设置提示文字颜色(需从父元素开始选中)

.weui-btn-area input::-webkit-input-placeholder{
/*font-size: 28px;*/
color:#989898;
        }

设置空格

&nbsp

设置&

&amp

CSS记录


width 高
height 布局
display
display:flex 阴影
box-shadow
box-shadow: 10rpx 10rpx 10rpx #909090; 边角弧度
border-radius
border-radius:20px;
border-radius:50%; 透明度
opacity 渐变色
background: linear-gradient(#b0b1f3, #8787f0); 内边距
padding 外边距
margin 上
top

bottom

left

right 引入网络图片
style="background-image:url({{item.thumb}});" 设置字体行距
line-height:22px
设置字体水平居中
text-align:center; 设置元素内第一个元素
.xj-smallspec :first-child{
margin: 0;
background: #000;
}
设置最后一个元素
last-child
 
 颜色循环渐变
-webkit-animation: hue 6s infinite linear;

vw(当前页面宽度视区等分为100,取值)

vh(当前页面高度视区等分为100,取值)

详见:https://www.zhangxinxu.com/study/201209/vw-vh-to-pixel.html

随机推荐

  1. 如何python循环中删除字典元素

    //下面这行就是在循环中遍历删除字典元素的方法! for i in list(dictheme2.keys()): if dictheme2[i]<self.countFortheme: dic ...

  2. python 图像识别的小应用

    前些天看见了几个有趣的python项目,在自己实际测试和理解后贴一下代码. https://www.shiyanlou.com/courses/589/labs/1964/document 算法主要逻 ...

  3. P5312 [Ynoi2011]D2T1

    思路:01trie 按位维护 提交:5边 错因:爆int + 少处理询问时的右端点 题解: 见代码(已经不想说什么了) 代码 //I have my own flg; #include<bits ...

  4. 原生JS实现图片上传并预览功能

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. The method setCharacterEncoding(String) is undefined for the type HttpServletResponse

    今天将以前做的一个web项目从不笔记本上移到台式机上,import项目后出现“The method setCharacterEncoding(String) is undefined for the ...

  6. 01 | 基础架构:一条SQL查询语句是如何执行的?

    这是专栏的第一篇文章,我想来跟你聊聊MySQL的基础架构.我们经常说,看一个事儿千万不要直接陷入细节里,你应该先鸟瞰其全貌,这样能够帮助你从高维度理解问题.同样,对于MySQL的学习也是这样.平时我们 ...

  7. PHPCMS v9插件包整合

    插件包是已经修改好的文件集合,您可以直接将插件包复制到您的网站中. 注意:插件包会替换phpcms中的文件,如果您修改过phpcms中的文件请先备份好旧的文件. 1.下载插件包 2.解压 3.复制里面 ...

  8. [洛谷201704R1]开心派对小火车

    OJ题号:洛谷P3697 思路: 贪心.首先从起点出发,开特急电车,对于每一个特急车站$s_{i}$,分别下一次车,计算从当前车站$s_{i}$出发坐各停电车在指定时限内$t$最远能够到达的车站$r_ ...

  9. c语言 数组类型

    数组类型重命名数组类型由元素类型和数组大小共同决定数组指针是一个指针,只想对应类型的数组指针数组是一个数组,其中每个元素都是指针数组指针遵循指针运算法则指针数组拥有c语言数组的各种特性 c通过type ...

  10. MySQL查询top N记录

    下面以查询每门课程分数最高的学生以及成绩为例,演示如何查询 top N记录.下图是测试数据,表结构和相关 insert 脚本见<常用SQL之日期格式化和查询重复数据>. 使用自连接[推荐] ...