Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>GetJson</title>
- <script type="text/javascript">
- jSon=[{
- "name": "Planning",
- "id": 1,
- "parentId": 994423,
- "children": [{
- "name": "Investigate",
- "id": 11,
- "parentId": 1
- }, {
- "name": "Assign resources",
- "id": 12,
- "parentId": 1
- }, {
- "name": "Gather documents",
- "id": 13,
- "parentId": 1
- }, {
- "name": "Report to management",
- "id": 17,
- "parentId": 1,
- "children": [{
- "name": "Implementation Phase 1",
- "id": 4,
- "parentId": 17,
- "children": [{
- "name": "Preparation work",
- "id": 34,
- "parentId": 4
- }, {
- "name": "Evaluate chipsets",
- "id": 14,
- "parentId": 4
- }, {
- "name": "Choose technology suite",
- "id": 16,
- "parentId": 4
- }, {
- "name": "Build prototype",
- "id": 15,
- "parentId": 4,
- "children": [{
- "name": "Step 1",
- "id": 20,
- "parentId": 15
- }, {
- "name": "Step 2",
- "id": 19,
- "parentId": 15
- }, {
- "name": "Step 3",
- "id": 18,
- "parentId": 15
- }, {
- "name": "Follow up with customer",
- "id": 21,
- "parentId": 15,
- "children": [{
- "name": "Customer approval",
- "id": 5,
- "parentId": 21
- }, {
- "name": "Implementation Phase 2",
- "id": 6,
- "parentId": 21,
- "children": [{
- "name": "Task 3",
- "id": 25,
- "parentId": 6
- }, {
- "name": "Task 2",
- "id": 26,
- "parentId": 6
- }, {
- "name": "Task 1",
- "id": 27,
- "parentId": 6,
- "children": [{
- "name": "Production phase 1",
- "id": 8,
- "parentId": 27,
- "children": [{
- "name": "Assemble",
- "id": 22,
- "parentId": 8
- }, {
- "name": "Load SW",
- "id": 23,
- "parentId": 8
- }, {
- "name": "Basic testing (inc some test)",
- "id": 24,
- "parentId": 8,
- "children": [{
- "name": "Customer approval 2",
- "id": 10,
- "parentId": 24
- }]
- }]
- }]
- }]
- }]
- }]
- }]
- }]
- }]
- }, {
- "name": "Final testing",
- "id": 9,
- "parentId": 123321
- }, {
- "name": "Delivery",
- "id": 7,
- "parentId": 654321
- }];
- </script>
- </head>
- <body>
- <div>
- <select id="selPath" onchange="dsplyPath.innerHTML=value"></select>
- <textarea id="dsplyPath" rows="5" cols="50"></textarea>
- </div>
- <script type="text/javascript">
- (function (obj,objName){
- obj.names= "";
- (function recurseIt(obj){
- for(var a in obj){
- if(typeof obj[a] == "object" ){
- obj[a].names= obj.names + (obj[a]["name"] ? "/" + obj[a]["name"]:"");
- recurseIt(obj[a]);
- }else{
- if(a == "name")selPath.add(new Option(obj[a],obj["names"]))
- }
- }
- })(obj);
- })(jSon);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement