JS BOM screen子对象

window.screen 对象包含有关用户屏幕的信息<div style="width:2000px;height:3000px;"></div>console.log(window.screen); 获取整个屏幕的宽度和高度var w = window.screen.width; var h = window.screen.height; 浏览器的可用宽度和高...

Read more

JS BOM navigator子对象

navigator需要在JS中获取客户端信息的时候 <?php echo '<pre>'; var_dump($_SERVER);die; //获取当前请求的userAgent $userAgent = $_SERVER['HTTP_USER_AGENT'];// lamp userAgent // var_dump(strp...

Read more

JS 样式获取 window.getComputedStyle

使用getComputedStyle获取元素样式的时候,一定要将样式的名称写完整 #test { border:solid 1px #ddd; } <div style="width:200px;height:200px;background:orange" id="test"></div> <script type="text/javascri...

Read more

JS onselect事件

<textarea name="" id="info" cols="30" rows="10"></textarea> <script type="text/javascript"> // /获取元素 var info = document.getElementById('info'); info.onselect = f...

Read more

JS 事件、IE attachEvent

事件的三要素: 事件源、事件类型、事件的处理程序准备知识<style type="text/css"> div{ width:100px; height:100px; background:#123548; margin-bottom:20px; } .item{ b...

Read more

JS 时间对象

创建的本机时间var t = new Date(); var t = new Date(2016, 9, 17, 16, 43, 40); // 月份的索引是从0 开始的 var t = new Date(2011,10,10,11,12,13); 获取年份var year = t.getFullYear(); 月份var month = t.getMonth()+1; if(m...

Read more

JS 数据类型(bsofun) 单双引号的区别

JavaScript是一种脚本编程语言,也是一种解释性语言 具有跨平台型JavaScript的程序通过客户端浏览器来解析的,与web服务器无关 在HTML中使用JS 使用标签src属性:表示包含要执行代码的外部文件type属性:text/javascript(可省略) <script type="text/javascript"> alert('iloveu'); <...

Read more

页面跳转的方式

a链接 <a href='http://www.baidu.com'> form表单 <form action ='1.php' method='post'> meta标签 <meta http-equiv="refresh" content="0.2;url=http://www.kaigesheji.com"> header函数 heade...

Read more

CSS 隔行隔列换色及常用属性

1. 隔行隔列换色 隔行换色 奇数table tr:nth-child(odd){background-color:yellow;}table tr:nth-child(2n-1){background-color:pink;}偶数table tr:nth-child(even){background-color:blue;}table tr:nth-child(2n){backgroun...

Read more