-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryingExample01.htm
More file actions
executable file
·30 lines (25 loc) · 984 Bytes
/
Copy pathQueryingExample01.htm
File metadata and controls
executable file
·30 lines (25 loc) · 984 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Querying Example</title>
</head>
<body>
<p>This example only works in Firefox 1.5+.</p>
<script type="text/javascript;e4x=1">
var employees = <employees>
<employee position="Software Engineer">
<name>Nicholas C. Zakas</name>
</employee>
<employee position="Salesperson">
<name>Jim Smith</name>
</employee>
</employees>;
var cats = employees.cat;
alert(cats.length()); //0
var allDescendants = employees..*; //get all descendants of <employees/>
alert(allDescendants);
var employees2 = employees.employee.parent();
alert(employees.contains(employees2));
</script>
</body>
</html>