使用背景:需要在其他JavaScript文件中调用AngularJS内部方法或改变$scope变量,同时还要保持双向数据绑定;首先获取AngularJS application:方法一:通过controller来获取appvar appElement = document.querySelector...
分类:
编程语言 时间:
2015-05-19 22:16:42
阅读次数:
951
Sometimes we want to add extra data to our form and submit them to the server.We can do this like :1 var form = document.querySelector('form');2 f...
分类:
其他好文 时间:
2015-05-16 23:20:26
阅读次数:
127
1. DOM扩展1.1 选择符APIl querySelector()接收一个css选择符,返回与该模式匹配的第一个元素l querySelectorAll()接收一个css选择符,返回所有匹配的NodeList元素1.2 HTML51.2.1 与类相关的扩充l getElementsByClass...
分类:
编程语言 时间:
2015-05-09 20:25:47
阅读次数:
205
jQuery被开发者如此的青睐和它强大的选择器有很大关系,比起笨重的document.getElementById、document.getElementByName… ,查找元素很方便,其实W3C中提供了querySelector和querySelectorAll查询接口已经实现了类似功能。定义其...
分类:
其他好文 时间:
2015-05-09 14:51:55
阅读次数:
129
原生的强大DOM选择器querySelector在传统的 JavaScript 开发中,查找 DOM 往往是开发人员遇到的第一个头疼的问题,原生的 JavaScript 所提供的 DOM 选择方法并不多,仅仅局限于通过 tag, name, id 等方式来查找,这显然是远远不够的,如果想要进行更为精...
分类:
其他好文 时间:
2015-04-28 01:36:20
阅读次数:
110
在传统的 JavaScript 开发中,查找 DOM 往往是开发人员遇到的第一个头疼的问题,原生的 JavaScript 所提供的 DOM 选择方法并不多,仅仅局限于通过 tag, name, id 等方式来查找,这显然是远远不够的,如果想要进行更为精确的选择不得不使用看起来非常繁琐的正则表达式,或...
分类:
其他好文 时间:
2015-04-23 13:01:02
阅读次数:
131
接上一篇代码 ?//?7?地理位置接口
??//?7.1?查看地理位置
??document.querySelector(‘#openLocation‘).onclick?=?function?()?{
????wx.openLocation({
??????latitude:?23.099994,
??...
分类:
微信 时间:
2015-04-22 00:45:46
阅读次数:
949
querySelector 和 querySelectorAll 方法是W3C Selectors API规范中定义的。他们的作用是根据 CSS 选择器规范,便捷定位文档中指定元素。目前几乎主流浏览器均支持了他们。包括 IE8(含) 以上版本、 Firefox、 Chrome、Safari、Oper...
分类:
编程语言 时间:
2015-04-17 13:26:13
阅读次数:
190
参考网址:http://www.w3cfuns.com/article-5593688-1-1.htmldocument.querySelector("body");//返回body节点document.querySelector("#k");//返回id为k的节点document.querySel...
分类:
其他好文 时间:
2015-04-12 19:01:39
阅读次数:
140
一、HTML5在JS方面新增的东西document.querySelector(“css选择器”);document .querySelectorAll(“css选择器”);var aEle = document.querySelectorAll(“li input[type=text]”);var...
分类:
Web程序 时间:
2015-04-10 19:20:49
阅读次数:
120