1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
>ExtJs</
title
>
<
meta
http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<
link
rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
<
script
type="text/javascript" src="ExtJs/ext-all.js"></
script
>
<
script
type="text/javascript" src="ExtJs/bootstrap.js"></
script
>
<
script
type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></
script
>
<
script
type="text/javascript">
Ext.onReady(function(){
var panel = new Ext.Panel({
title: 'SAMPLE',
renderTo: 'sub1',
width: '500px',
html: '<
div
id="div0" style="height:260px;padding:5px"><
div
id="div1">我是第一个DIV的文本</
div
><
div
id="div2">' +
'<
div
id="div3">我是第一个DIV的内容</
div
></
div
></
div
>'
});
var tarArry = Ext.query('#div0 div');
var except = Ext.core.DomQuery.filter(tarArry, "#div1", true);
var include = Ext.core.DomQuery.filter(tarArry, "#div1", false);
var isInclude = Ext.core.DomQuery.is(except, '#div0');
var selectNode = Ext.core.DomQuery.selectNode("div0 div");
function retStr(array){
var str = "";
for(var i=0;i<
array.length
;i++){
if(i<array.length-1)
str +=(array[i].id + ";");
else {
str += array[i].id;
}
}
return str;
}
Ext.Msg.alert('返回结果', "不包含ID为DIV1的所有DIV的ID为: " + retStr(except) +
"<br>包含ID为DIV1的所有DIV的ID为: " + retStr(include) +
"<
br
>通过EXT.CORE.DOMHELPER.IS(EXCEPT, #DIV0的返回结果:)" + isInclude +
",<
br
>表示" + retStr(except) + "是否包含ID为DIV的节点:" +
"<
br
>在ID为DIV0的第一个节点的ID是: " + selectNode);
});
</
script
>
</
head
>
<
body
>
<
div
id=sub1></
div
>
</
body
>
</
html
>
|
ExtJs之Ext.core.DomQuery
最新推荐文章于 2024-09-07 14:37:16 发布