Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Walking the DOM</title>
  6. <script src="isht.js"></script>
  7. <script>
  8. isht.directive('inder',function(){
  9. var attrs = ['first'];
  10. return function(node) {
  11. for(var i=0;i<attrs.length;i++) {
  12. var child = document.createElement("P");
  13. var textNode = document.createTextNode("Value of " + attrs[i] + " is : " + node.getAttribute(attrs[i]));
  14. child.appendChild(textNode);
  15. node.appendChild(child);
  16. }
  17. }
  18. });
  19.  
  20. isht.directive('shunny',function(){
  21. var attrs = ['first'];
  22. return function(node) {
  23. for(var i=0;i<attrs.length;i++) {
  24. var child = document.createElement("P");
  25. var textNode = document.createTextNode("Cool : " + attrs[i] + " is : " + node.getAttribute(attrs[i]));
  26. child.appendChild(textNode);
  27. node.appendChild(child);
  28. }
  29. }
  30. });
  31. </script>
  32. </head>
  33. <body>
  34. <inder first="10">
  35. </inder>
  36.  
  37. <shunny first="20">
  38. </shunny>
  39.  
  40. <script>
  41. isht.bootstrap();
  42. </script>
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement