Home > Web Front-end > JS Tutorial > Summary of basic operations of jscss

Summary of basic operations of jscss

php中世界最好的语言
Release: 2018-06-04 10:48:55
Original
1891 people have browsed it

这次给大家带来jscss基础操作总结,jscss基础操作的注意事项有哪些,下面就是实战案例,一起来看一下。

返回上一页:

<button onclick="goBack()">返回上一页</button>
<script>
function goBack(){
window.history.go(-1)     -2即为退后2页
}
</script>
Copy after login

点击回到顶部

document.body.scrollTop = 0
document.documentElement.scrollTop = 0
Copy after login

css中超出变为省略号:

<style>
div{
width:100%;
overflow: hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
</style>
Copy after login

微软雅黑的写法:
1)、“微软雅黑” 转换Unicode编码“\5FAE\8F6F\96C5\9ED1”

div{font-family:”\5FAE\8F6F\96C5\9ED1”}
Copy after login


div内css字体一样是设置为“微软雅黑”
2)、“微软雅黑”使用英文“Microsoft YaHei”

div{font-family:”Microsoft YaHei”}
Copy after login

es6中 数组去重

this.newarr = Array.from(new Set(this.arr))
Copy after login

Object.keys(obj) ----- 将对象排序输出
obj 要返回其枚举自身属性的对象。--- 要排序的对象
eg:

var anObj = { 100: &#39;a&#39;, 2: &#39;b&#39;, 7: &#39;c&#39; };
console.log(Object.keys(anObj));   // console: [&#39;2&#39;, &#39;7&#39;, &#39;100&#39;]
Copy after login

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

使用JS实做出加密解密操作

怎样利用JS做出引用传递与值传递

The above is the detailed content of Summary of basic operations of jscss. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template