这里就不多说了,直接贴上代码:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta http-equiv="Content-Language" content="zh-cn"> <title>时间</title> </head> <body> </body> </html> <script> function getBeforeDate(n){var n = n;var d = new Date();var year = d.getFullYear();var mon=d.getMonth()+1;var day=d.getDate();if(day <= n){if(mon>1) {mon=mon-1;}else {year = y...
1.参考利用 Python + Selenium 自动化快速截图利用 Python + Selenium 实现对页面的指定元素截图(可截长图元素)使用python获取系统所有进程PID以及进程名称 python锁定焦点到指定进程窗口的参考方法 2.改进js代码,下拉和上拉,精确判断加载是否结束#!/usr/bin/env python# -*- coding: UTF-8 -*import timefrom selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.common.exceptio...
尺寸类样式的获取offsetHeightHTMLElement.offsetHeight 是一个只读属性,它返回该元素的像素高度,高度包含该元素的垂直内边距和边框,且是一个整数。(content+padding+border)通常,元素的offsetHeight是一种元素CSS高度的衡量标准,包括元素的边框、内边距和元素的水平滚动条(如果存在且渲染的话),不包含:before或:after等伪类元素的高度。对于文档的body对象,它包括代替元素的CSS高度线性总含量高。浮动元素的向下延伸内容...
JS获取各种宽度、高度的简单介绍:scrollHeight: 获取对象的滚动高度。 scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离 scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离 scrollWidth:获取对象的滚动宽度 offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度 offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置...
网页可见区域宽: document.body.clientWidth 网页可见区域高: document.body.clientHeight 网页可见区域宽: document.body.offsetWidth (包括边线的宽) 网页可见区域高: document.body.offsetHeight (包括边线的高) 网页正文全文宽: document.body.scrollWidth 网页正文全文高: document.body.scrollHeight 网页被卷去的高: document.body.scrollTop 网页被卷去的左: document.body.scrollLeft 网页正文部分上: window.sc...
var date = new Date(); //月 var month = date.getMonth(); month = month + 1; if ((month)<10) { month = "0"+month; } //日 var riqi = date.getDate(); if (riqi<10) { riqi = "0"+riqi; } //小时 var hour = date.getHours(); if (hour<10) { hour = "0"+hour; } //分钟 var minute = date.getMinutes(); if (m...
function GetRequest() {var url = decodeURIComponent(location.search); //获取url中"?"符后的字串var theRequest = new Object();if (url.indexOf("?") != -1) {var str = url.substr(1);strs = str.split("&");for (var i = 0; i < strs.length; i++) {var tempArr = strs[i].split("=");// 类型转换if (tempArr[1] == ‘true‘) {tempArr[1] = true;}if (tempArr[1] == ‘false‘) {tempArr[1] = false;}if (/^[\d|.]+$/.test...
<!DOCTYPE html> <html> <head><meta charset="utf-8"><title></title> </head><script type="text/javascript">function huoqu(){var G=document.getElementById(‘value‘).value;alert(G);}</script><body><div class="containter"><div class="row"><div class="md-col-12"><input type="text" id="value" placeholder="要获取的输入的值"/><input type="button" value="打印" onclick="huoqu()"/></div></div></div></body></...
<Script language="javascript"> function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for(var i = 0; i < strs.length; i ++) { theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } return theRequest; } </script> 其他参数...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns= "http://www.w3.org/1999/xhtml" > <head> <meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" /> <title> javascript 动态创建 input 文本框</title> <style type= "text/css" > <!-- body { font :12px “ Microsoft Sans Serif” ;}.TextStyle{ width :30...
function getNowFormatDate() { var date = new Date(); var seperator1 = "-"; var seperator2 = ":"; var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDa...
//获取视口的高度和宽度。 function windowHeight() { var de = document.documentElement; return self.innerHeight||(de && de.offsetHeight)||document.body.offsetHeight; } function windowWidth() { var de = document.documentElement; return self.innerWidth||( de && de.offsetWidth )||document.body.offsetWidth; }原文:http://www.cnblogs.com/zhaoyang-1989/p/4576674.html
视口的宽和高var pw = window.innerWidth,ph = window.innerHeight;if(typeof pw != "number"){pw = document.documentElement.clientWidth;ph = document.documentElement.clientHeight;}console.log(pw,ph); 原文:http://www.cnblogs.com/xupeiyu/p/4677252.html
先说一下JS的获取方法,其要比JQUERY的方法麻烦很多,后面以JQUERY的方法作对比。JS的方法会比JQUERY麻烦很多,主要则是因为FF浏览器,FF浏览器会把你的换行也当最DOM元素<div id="test"><div></div><div></div></div>原生的JS获取ID为test的元素下的子元素。可以用:var a = docuemnt.getElementById("test").getElementsByTagName("div"); 这样是没有问题的此时a.length=2;但是如果我们换另一种方法var b =document.getElement...
第一种 通过正则获取URL中指定的参数/** * 获取指定的URL参数值 * URL:http://www.xxx.com/index?name=123* 参数:param URL参数 * 调用方法:getParam("name") * 返回值:123* alert(getParam(‘date‘));*/function getParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); //search,查询?后面的参数,并匹配正则var r = location.search.substr(1).match(reg); if (r != null) return decodeURI(deco...