JavaScript中BOM的基础知识总结
//1.系统对话框
//alert() confirm() prompt()
// alert(123);
// confirm(456);//用户点击确定返回true 否则返回false
//
// prompt(789);//弹出一个让用户输入数据的对话框
//没有输入返回空 点击取消返回null
//第二个参数返回默认值
// var num = prompt("返回输入的值","默认值");
// alert(num); //print();//显示打印对话框
//find();//显示查找对对话框 ; //2.新建窗口
//第二个参数给打开的窗口命名
//window.open("http://www.baidu.com","qingkun");
//window.open("tabs.html");
//第三个参数用来设置新窗口的属性
//window.open("tabs.html","qingkun","width=300,height=300"); //3.窗口的位置和大小
//位置
//IE,Google支持:screenLeft screenTop
//alert(window.screenLeft);
//alert(window.screenTop); //firefox google支持screenX screenY
//alert(window.screenX);
// alert(window.screenY); //兼容性写法
// var x = typeof screenLeft == "number"? screenLeft:screenX;
// var y = typeof screenTop == "number"? screenTop:screenY;
// alert(x+","+y); //获取窗口大小 IE8不支持
// alert(window.innerHeight);//窗口页面高度
// alert(window.innerWidth);//窗口页面宽度 // alert(window.outerHeight);//窗口高度+边框高度
// alert(window.outerWidth);//窗口宽度+边框宽度 //IE 8
// document.documentElement.clientHeight;
// document.documentElement.clientWidth;
//IE 6
// document.body.clientHeight
// document.body.clientWidth //兼容性
// var width = innerWidth;
// var height = innerHeight;
// if(typeof width != "number"){
// if (document.compatMode == "CSS1Compat") {
// width = document.documentElement.clientWidth;
// height = document.documentElement.clientHeight;
// }else{
// width = document.body.clientWidth;
// height = document.body.clientHeight;
// }
//
// } //4.间隔调用和超时调用
//超时调用 setTimeout
//setTimeout("alert('123')",1000); // function show(){
// alert(123);
// }
// setTimeout(show,1000); // var a = setTimeout(function(){
// alert(123);
// },1000);
// alert(a);//返回一个唯一的整数值
// clearTimeout(a);//清除超时调用 //间隔调用 setInterval 重复执行
// var b = setInterval(function(){
// alert("hello");
// },1000);
//
// setTimeout(function(){
// clearInterval(b);
// },1000);
// //实现一个定时器的功能 5s
// var s = 0;
// var a = setInterval(function(){
// s++;
// if (s == 5) {
// alert("计时结束");
// clearInterval(a);
// }
// },1000); //location
//window.location.href = "http://www.baidu.com?name=lisi&age=23";
//alert(window.location); // alert(window.location.protocol);//协议
// alert(window.location.hostname); //主机名
// alert(window.location.port);//端口号
// alert(window.location.pathname)//路径 //alert(window.location.hash);//获取锚点
//alert(window.location.search);//获取?后面 //截取?后面 function getSearch(){
var arrs = {};
//?name=lisi&age=23
var str = window.location.search.length>0?window.location.search.substring(1):"";
//alert(typeof str);
var arr = str.split("="); var a = null,m = null,n = null;
//alert(typeof arr)
console.log(arr[1]);
for (var i=0;i<arr.length;i++) {
a = arr[i].split("=");
m = a[0];
n = a[1];
arrs[m]=n;
}
return arrs;
}
var sss = getSearch();
//console.log(sss);
//alert(arrs["name"]);
// alert(arrs["age"]); //2:
var str = "name=qingkun&age=23";
var arr = str.split("&");
var arrs = {};
// console.log(arr);
for (var i=0;i<arr.length;i++) {
var a = arr[i].split("=");
// console.log(a);
var m = a[0];
var n = a[1];
arrs[m] = n;
}
// alert(JSON.stringify(arrs));
for (var j in arrs) {
// console.log(j);
// console.log(arrs[j]);
} //改变地址栏中的地址
function changeUrl(){
window.location.href = "tabs.html";//当前窗口
//window.open("tabs.html");//新窗口
// window.location.assign("tabs.html");
// window.location.replace("tabs.html");//不会生成历史记录
// window.open("tabs.html");//新窗口
// window.location.reload();//从缓存中加载
// window.location.reload(true);//从服务器中加载 }
JavaScript中BOM的基础知识总结的更多相关文章
- javascript中BOM部分基础知识总结
一.什么是BOM BOM(Browser Object Document)即浏览器对象模型. BOM提供了独立于内容 而与浏览器窗口进行交互的对象: 由于BOM主要用于管 ...
- day29—JavaScript中DOM的基础知识应用
转行学开发,代码100天——2018-04-14 JavaScript中DOM操作基础知识即对DOM元素进行增删改操作.主要表现与HTML元素的操作,以及对CSS样式的操作.其主要应用知识如下图: 通 ...
- javascript中DOM部分基础知识总结
1.DOM介绍 1.1 DOM概念 文档对象模型(Document Object Model),它定义了访问和处理HTML文档的标准方法.现在我们主要接触到的是HTML DOM. ...
- JavaScript中数组的基础知识和相关方法
数组基础 数组是大多数语言里面最常见的一种数据结构,它是一个有序的值列表. 创建数组 1.创建字面量数组 let arr=[]; 2.创建构造函数数组 let arr=new Array(); 注 ...
- ASP.NET中的C#基础知识
ASP.NET中的C#基础知识 说明:asp.net作为一种开发框架现在已经广为应用,其开发的基础除了前端的html.css.JavaScript等后端最重要的语言支持还是C#,下面将主要用到的基础知 ...
- MySQL中索引的基础知识
本文是关于MySQL中索引的基础知识.主要讲了索引的意义与原理.创建与删除的操作.并未涉及到索引的数据结构.高性能策略等. 一.概述 1.索引的意义:用于提高数据库检索数据的效率,提高数据库性能. 数 ...
- javascript中正则表达式的基础语法
× 目录 [1]定义 [2]特点 [3]元字符[4]转义字符[5]字符组[6]量词[7]括号[8]选择[9]断言[10]模式[11]优先级[12]局限性 前面的话 正则表达式在人们的印象中可能是一堆无 ...
- 掌握javascript中的最基础数据结构-----数组
这是一篇<数据结构与算法javascript描述>的读书笔记.主要梳理了关于数组的知识.部分内容及源码来自原作. 书中第一章介绍了如何配置javascript运行环境:javascript ...
- 浅谈:javascript的面向对象编程之基础知识的介绍
在进入javascript的面对对象之前,我们先来介绍一下javascript的几个概念. 1.javascript的面向对象的基本概念 function aa(){ } /* * 这里的aa,在我们 ...
随机推荐
- hdu 3642 覆盖3次以上体积
http://www.cnblogs.com/kane0526/archive/2013/03/06/2947118.html 题目大意:给你n个立方体,求相交区域大于等于三次的体积和. 这题需要前面 ...
- 集合异常之List接口
List接口介绍:是Collection接口中的子类, 特点: l 它是一个元素存取有序的集合.例如,存元素的顺序是11.22.33.那么集合中,元素的存储就是按照11.22.33的顺序完成的).( ...
- sort遇到的问题
var arr = [2,10,6,9,7,8]; var arr1 = arr.sort(); var arr2 = arr.sort(function(a,b){ if (a>b){ ret ...
- 对json缓存进行操作
var data={ id:1, name:"张三" } //存储缓存 var arrdata=[]; arrdata.push({id:data.id,name:data.nam ...
- vuejs+axios发送请求
Vue 原本有一个官方推荐的 ajax 插件 vue-resource,但是自从 Vue 更新到 2.0 之后,官方就不再更新 vue-resource 目前主流的 Vue 项目,都选择 axios ...
- Iscrool下拉刷新
简易下拉刷新 css样式: *{ margin: 0px; padding: 0px; } #wrapper{ width: 100%; height: 150px; border: 1px soli ...
- asp.net后台获取html控件的值
1.asp.net后台获取前台type=text控件的值 前台:<input name="txtName" class="username" type=& ...
- C++基础--结构体声名
struct是一种数据结构,当需要存储的相关数据为一个集合时,struct是很好的选择;例如,当存储student,学生的学号, 名字,年龄,身高,就构成了一个集合,用stuct声名为: typede ...
- 数据库系统异常排查之DMV(转)
来源: http://www.cnblogs.com/fygh/archive/2012/03/12.html 数据库系统异常是DBA经常要面临的情景,一名有一定从业经验的DBA,都会有自己一套故障排 ...
- March 6 2017 Week 10 Monday
A well-spent day brings happy sleep. 丰盈白日,安眠晚间. Recently my sleep is not so good, for one thing I go ...