Guest User

Untitled

a guest
Jun 24th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. function createButton() {
  2. var a = document.createElement('a');
  3. a.href = '#';
  4. a.innerHTML = 'Print Topic';
  5. a.style.position = 'absolute';
  6. a.style.right = '3em';
  7. a.style.top = '6em';
  8. a.style.fontFamily = 'Arial,Helvetica,sans-serif';
  9. a.style.fontWeight = 'bold';
  10. a.style.fontSize = '125%';
  11. a.style.background = '#777777 none repeat scroll 0 0';
  12. a.style.color = 'white';
  13. a.style.padding = '6px 12px';
  14. document.body.insertBefore(a, document.body.lastChild);
  15. }
  16.  
  17. function createButton() {
  18. var a = document.createElement('a');
  19. var css = document.createElement('style');
  20. css.type = 'text/css';
  21. css.innerHTML = '#prt { position:absolute; right:3em; top: 6em; font-family: Arial,Helvetica,sans-serif; font-weight:bold; font-size:125%; background: #777777 none repeat scroll 0 0; color: white; padding: 6px 12px;}'
  22. a.href = '#';
  23. a.innerHTML = 'Print Topic';
  24. a.id = 'prt';
  25. document.body.insertBefore(a, document.body.lastChild);
  26. document.body.appendChild(css);
  27. }
  28.  
  29. s = a.style;
  30.  
  31. s.position = "absolute";
  32. ...etc...
  33. s.color = "white";
  34.  
  35. $("a").css({position: "absolute", right: "3em", top: "6em"}) // etc.
  36.  
  37. $("<a href='toto/'></a>")
  38. .css("position", "absolute");
  39. .css("right", "3em")
  40. .appendTo($(containerid));
  41.  
  42. with a.style {
  43. position = 'absolute';
  44. right = '3em';
  45. }
  46.  
  47. function setStyle(elem) {
  48. with elem.style {
  49. position = 'absolute';
  50. right = '3em';
  51. }
  52.  
  53. return elem
  54. }
  55.  
  56. //Invoke like this: elem = setStyle(elem)
  57.  
  58. <style type='text/css'>
  59. a .prt {
  60. position:absolute;
  61. right:3em;
  62. top: 6em;
  63. font-family: Arial,Helvetica,sans-serif;
  64. font-weight:bold;
  65. font-size:125%;
  66. background: #777777 none repeat scroll 0 0;
  67. color: white; padding: 6px 12px;
  68. }
  69. </style>
  70. <script>
  71. function createButton() {
  72. var a = document.createElement('a');
  73. a.class= 'prt';
  74. document.body.insertBefore(a, document.body.lastChild);
  75. }
  76. </script>
Add Comment
Please, Sign In to add comment