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,在我们 ...
随机推荐
- HashMap和Hashtable存放null
Hashmap是可以放key为null的,Hashtable不能放key为null.hashtable放key为null会报空指针异常 1. hashmap put方法源码 public V put( ...
- Android-自定义View实现ImageView播放gif
http://blog.csdn.net/guolin_blog/article/details/11100315 总体思路是这样的 PowerImageView类继承ImageView类 给Powe ...
- 重构指南 - 使用多态代替条件判断(Replace conditional with Polymorphism)
多态(polymorphism)是面向对象的重要特性,简单可理解为:一个接口,多种实现. 当你的代码中存在通过不同的类型执行不同的操作,包含大量if else或者switch语句时,就可以考虑进行重构 ...
- Android 使用RecyclerView优雅实现悬浮标题通讯录
项目地址:https://github.com/hgDendi/ContactsList 界面概览: ContactsListDemo ContactsListDemo2 概要 如图,主要简单划分为两 ...
- CentOS 7 使用 yum 安装 jdk 1.8
安装之前先检查一下系统有没有自带open-jdk 命令: rpm -qa |grep java rpm -qa |grep jdk rpm -qa |grep gcj 如果没有输入信息表示没有安装. ...
- 【Leetcode】【Easy】Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...
- (一)selenium发展史(专治selenium小白)
Jason Huggins在2004年发起了Selenium项目,当时身处ThoughtWorks的他,为了不想让自己的时间浪费在无聊的重复性工作中,幸运的是,所有被测试的浏览器都支持Javascri ...
- 319. Bulb Switcher (Math, Pattern)
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every ...
- python接口测试-项目实践(四)拼接出预期结果
四 字符串拼接 空值处理 当某字段接口数据为空,则不显示相关字串. 比如字串原本是 "...,净资产收益率:ROE%",当接口数据中ROE为空,不显示',净资产收益率:%' 三目运 ...
- 关于rapidxml无法解析中文路径问题
先放结果 setlocale(LC_ALL, ""); rapidxml::file<> f(szPath); setlocale(LC_ALL, "C&qu ...