Guest User

Untitled

a guest
Jun 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. /* Return a DOM element with tag name |elem| and attributes |attrs|. */
  2. function DOM(elem, attrs) {
  3. var elem = document.createElement(elem);
  4. for (var attr in attrs) {
  5. elem[attr] = attrs[attr];
  6. }
  7. return elem;
  8. }
  9.  
  10.  
  11. // use like:
  12.  
  13. root = DOM('a', {href:page.url,
  14. title:page.title});
  15.  
  16. var input = DOM('input', {type:'text',
  17. className:'hint',
  18. value:url.short_name});
Add Comment
Please, Sign In to add comment