| 16 | | dojo.behavior.add({ |
| 17 | | "border": function(elem){ |
| 18 | | with(elem.style){ |
| 19 | | border = "3px solid blue"; |
| 20 | | padding = "5px"; |
| 21 | | margin = "5px"; |
| 22 | | } |
| 23 | | }, |
| 24 | | "clickSet": { |
| 25 | | "onclick": function(evt){ |
| 26 | | alert("clicked!"); |
| 27 | | } |
| 28 | | }, |
| 29 | | "topicClickSet": { "onclick": "/foo/bar" }, |
| 30 | | "addNodesButton": { "onclick": function(evt){ |
| 31 | | var tNode = document.createElement("div"); |
| 32 | | tNode.id = "border"; |
| 33 | | document.body.appendChild(tNode); |
| 34 | | tNode.innerHTML = "this should get a border when you hit the re-apply button"; |
| 35 | | |
| 36 | | tNode = document.createElement("div"); |
| 37 | | tNode.id = "clickSet"; |
| 38 | | document.body.appendChild(tNode); |
| 39 | | tNode.innerHTML = "this will become clickable when you hit the re-apply button"; |
| 40 | | |
| 41 | | } }, |
| 42 | | "reApplyButton": { "onclick": { targetObj: dojo.behavior, targetFunc: "apply" } } |
| 43 | | }); |
| 44 | | |
| 45 | | dojo.event.topic.subscribe("/foo/bar", function(){ |
| 46 | | alert("event handled via the /foo/bar topic"); |
| 47 | | }); |
| 48 | | |
| 49 | | |
| 50 | | dojo.event.connect(dojo.behavior, "apply", function(){ |
| 51 | | dojo.profile.dump(true); |
| | 16 | dojo.addOnLoad(function(){ |
| | 17 | dojo.behavior.add({ |
| | 18 | "border": function(elem){ |
| | 19 | with(elem.style){ |
| | 20 | border = "3px solid blue"; |
| | 21 | padding = "5px"; |
| | 22 | margin = "5px"; |
| | 23 | } |
| | 24 | }, |
| | 25 | "clickSet": { |
| | 26 | "onclick": function(evt){ |
| | 27 | alert("clicked!"); |
| | 28 | } |
| | 29 | }, |
| | 30 | "topicClickSet": { "onclick": "/foo/bar" }, |
| | 31 | "addNodesButton": { "onclick": function(evt){ |
| | 32 | var tNode = document.createElement("div"); |
| | 33 | tNode.id = "border"; |
| | 34 | document.body.appendChild(tNode); |
| | 35 | tNode.innerHTML = "this should get a border when you hit the re-apply button"; |
| | 36 | |
| | 37 | tNode = document.createElement("div"); |
| | 38 | tNode.id = "clickSet"; |
| | 39 | document.body.appendChild(tNode); |
| | 40 | tNode.innerHTML = "this will become clickable when you hit the re-apply button"; |
| | 41 | |
| | 42 | } }, |
| | 43 | "reApplyButton": { "onclick": { targetObj: dojo.behavior, targetFunc: "apply" } } |
| | 44 | }); |
| | 45 | |
| | 46 | dojo.event.topic.subscribe("/foo/bar", function(){ |
| | 47 | alert("event handled via the /foo/bar topic"); |
| | 48 | }); |
| | 49 | |
| | 50 | |
| | 51 | dojo.event.connect(dojo.behavior, "apply", function(){ |
| | 52 | dojo.profile.dump(true); |
| | 53 | }); |