js串讲整理
js子级窗口向父级窗口传值
<!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>无标题文档</title>
<script language="javascript">
var a = window.open("b.php","_blank","width=200 height=200 toolbar=no"); //在新窗口打开b.php //window.setTimeout("ccc()",3000); function ccc()
{
a.close();
}
</script>
</head> <body>
<div id="dd"></div>
</body>
</html>
<!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>无标题文档</title>
<script language="javascript">
function dodo()
{
//取出值
var s = document.getElementById("t1").value; //给父窗口
var dd = window.opener.document.getElementById("dd"); //opener打开父级窗口
dd.innerHTML = s;
}
</script>
</head> <body>
<form>
<input type="text" id="t1" name="t1">
<input type="button" value="点击给父窗口" onclick="dodo()">
</form>
</body>
</html>
js一次打开或关闭多个窗口
<!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>无标题文档</title>
<script language="javascript"> var arr = new Array();
function doopen()
{
for(var i=1;i<=5;i++)
{
arr[i-1] = window.open("b.php","_blank","width=200 height=100 toolbar=no");
}
}
function doclose()
{
for(var i=0;i<arr.length;i++)
{
arr[i].close();
}
} </script>
</head> <body>
<div id="dd"></div>
<span onClick="doopen()">打开5个子窗口</span>
<span onclick="doclose()">关闭5个子窗口</span> </body>
</html>
window.location.href="..."; 跳转页面
window.location.reload(); 刷新页面
document.getElementById(); 根据id找
document.getElementsByName(); 根据name找
document.getElementsByClassName(); 根据class找
document.getElementsByTagName(); 根据标签找
getAttribute() 获取属性
setAttribute() 赋予属性
removeAttribute() 移除属性
表单元素 value
非表单元素 innerHTML innerText
js串讲整理的更多相关文章
- js串讲回顾
注:1.xx.nextSibling.css.xxx->xx的下一个元素的css样式;2. window.opener.document.getElementById("cms&quo ...
- JS正则表达式大全(整理详细且实用)
JS正则表达式大全(整理详细且实用).需要的朋友可以过来参考下,希望对大家有所帮助!! 正则表达式中的特殊字符 字符 含意 \ 做为转意,即通常在"\"后面的字符不按原来意义解释, ...
- js数组学习整理
原文地址:js数组学习整理 常用的js数组操作方法及原理 1.声明数组的方式 var colors = new Array();//空的数组 var colors = new Array(3); // ...
- Js Date泣血整理
原文:Js Date泣血整理 JS Date 对象用于处理日期和时间. 创建 Date 对象的语法: var myDate=new Date() Date 对象会自动把当前日期和时间保存为其初始值. ...
- vue.js面试题整理
Vue.js面试题整理 一.什么是MVVM? MVVM是Model-View-ViewModel的缩写.MVVM是一种设计思想.Model 层代表数据模型,也可以在Model中定义数据修改和操作的业务 ...
- SVG.js 元素操作整理(二)-Transform
一.transform()获取或设置矩阵变换 var draw = SVG('svg1').size(300, 300); //Transforming SVG元素矩阵变换 var rect = dr ...
- SVG.js 元素操作整理(一)
一.属性操作Attributes var draw = SVG('svg1').size(300, 300); //attr() 属性操作 //设置属性的值 var rect = draw.rect( ...
- 0607pm克隆&引用类&加载类&面向对象串讲&函数重载
克隆class Ren{ public $name; public $sex; function __construct($n,$s) { $this->name=$n; $this->s ...
- 【前端芝士树】Vue.js面试题整理 / 知识点梳理
[前端芝士树] Vue.js 面试题整理 MVVM是什么? MVVM 是 Model-View-ViewModel 的缩写. Model代表数据模型,也可以在Model中定义数据修改和操作的业务逻辑. ...
随机推荐
- Javascript读写文件
<script type="text/javascript" language="javascript"> //读文件 function readF ...
- iOS小知识点(UI部分)
1. 父视图通过Tag来找到UIView UIView *targetView = [superView viewWithTag:10];//只在当前视图以及subviews中找,不能再孙子中找. 2 ...
- EL表达式怎么获取Map的动态key?
缘由 El表达式在调用Map的时候,后台传过来的Map的key不一定是一个固定的值,需要根据另外一个对象的id作为key来put,或者更加复杂的组合id+"string"作为一个k ...
- gulp错误GulpUglifyError: unable to minify JavaScript解决
这个错误是由于在打包js代码时,js语法错误导致的,修改以下js的语法即可.
- Install Docker on Ubuntu
Install Docker on Ubuntu Estimated reading time: 17 minutes Docker is supported on these Ubuntu oper ...
- HTML颜色、超链接设置
<html> <head> <title>显示的页面选项卡标题</title> <style type="text/css"& ...
- 转-ArcGIS Engine中的License设置
AE开发中的License有两种方法进行设置,一种是通过LicenseControl控件,另一种是通过IAoInitialize接口设置.整个应用程序中只能有一种方式存在,如果进行了两种License ...
- Google 地图 API V3 之 叠加层
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- mod-mono
http://go-mono.com/config-mod-mono/ 配置文件生成器 Mono remote debugging from Visual Studio http://stackov ...
- [Java] JSP笔记 - Java Bean
一. Java Bean 是什么? Java Bean 其实就是一个符合特定规则的 Java Class.这些规则包括: 使用 public 声明的公用类 属性使用public 的get,set方法访 ...