js 知识总结
来源:互联网 发布:村淘和淘宝有什么区别 编辑:程序博客网 时间:2024/06/08 03:57
JS 总结
事件
1 语法: onclick = js ("函数")("语句")
2 事件句柄: onclick onfcus ...
3 鼠标/键盘属性: altKey (event.altKey==1 表示alt 这个建被按)event.clientX(鼠标横坐标)
DOM 处理
1 访问节点
getElementById() getElementsByTagName() getElementsByClassName("");
2 操作html
改变html内容:document.getElementById(id).innerHtml = new Html
改变html属性:(获取节点).attribute = new value
(document.getElementById("image").src = "a.jpg":)
3 操作css
改变css样式:(获取节点).style.property = new style
document.getElementById("p2").style.color = "bule";
显示影藏:(获取节点).visibility = 'hidden' (visible)
4 操作节点
增加节点 步骤
1 创建<p>
var para = doucument.createElemnt("p");
2 创建节点内容
var node = doucument.createTextNode("内容");
3 将内容追加到节点
para.appendChild(node);
4 将新元素放入指定的位置
var elemnet = document.getElementById("div1");
element.appenChild(para);
删除节点
var parent = document.getElementById("div1");
var child = document.getElemntById("p1");
parent.removeChild(child);
Window(BOM流浪器对象模型)
1 window :window.innerHeight(Width)浏览器的高和宽
2 screen:screen.availWidth(Height) 可用屏幕宽高
3 Location: window.location("src") 刷新
4 History: window.history.back() (forward) 无刷新
5 PopuAlert: alert("警告框"); confirm("确定框") ; prompt("提示框")
事件
1 语法: onclick = js ("函数")("语句")
2 事件句柄: onclick onfcus ...
3 鼠标/键盘属性: altKey (event.altKey==1 表示alt 这个建被按)event.clientX(鼠标横坐标)
DOM 处理
1 访问节点
getElementById() getElementsByTagName() getElementsByClassName("");
2 操作html
改变html内容:document.getElementById(id).innerHtml = new Html
改变html属性:(获取节点).attribute = new value
(document.getElementById("image").src = "a.jpg":)
3 操作css
改变css样式:(获取节点).style.property = new style
document.getElementById("p2").style.color = "bule";
显示影藏:(获取节点).visibility = 'hidden' (visible)
4 操作节点
增加节点 步骤
1 创建<p>
var para = doucument.createElemnt("p");
2 创建节点内容
var node = doucument.createTextNode("内容");
3 将内容追加到节点
para.appendChild(node);
4 将新元素放入指定的位置
var elemnet = document.getElementById("div1");
element.appenChild(para);
删除节点
var parent = document.getElementById("div1");
var child = document.getElemntById("p1");
parent.removeChild(child);
Window(BOM流浪器对象模型)
1 window :window.innerHeight(Width)浏览器的高和宽
2 screen:screen.availWidth(Height) 可用屏幕宽高
3 Location: window.location("src") 刷新
4 History: window.history.back() (forward) 无刷新
5 PopuAlert: alert("警告框"); confirm("确定框") ; prompt("提示框")
- Js 知识总结
- js 知识总结1
- js 知识总结2
- js 知识总结
- js 知识总结
- js知识总结
- angular js知识总结
- js知识总结
- JS知识一:系统知识笔记总结
- js第一天知识总结
- js第二天知识总结
- js第三天知识总结
- js运算符知识总结
- js常用知识总结01
- js常用知识总结02
- Node js 相关知识总结
- js常用知识总结(未完待续)
- 项目总结-前台js小知识
- SSH框架的整合
- jdk,eclipse,tomcat,plug等的安装
- FSL camera preview with V4l2
- COC游戏的开发(2)
- 判断是否回文数
- js 知识总结
- Android开发之fsl在HAL层Camera的实现
- linux下用脚本实现:监控一个进程,不存在则将其启动。
- c标签和struts2标签一些用法上的区别
- 如何减小与“大牛”的差距
- 多进程和多线程
- 字符串与byte数组的转换
- FSL Camer 调试
- 怎样做好seo优化 以seo基础问题为基点