Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. button.setAttribute('style', 'float: right;');
  2.  
  3. button.style = 'float: right;';
  4.  
  5. button.style.setAttribute('cssFloat','right');
  6.  
  7. button.style.cssFloat = 'right';
  8.  
  9. function setStyle(el,spec) {
  10. for (var n in spec) {
  11. el.style[n] = spec[n];
  12. }
  13. }
  14.  
  15. setStyle(button,{
  16. cssFloat : 'right',
  17. border : '2px solid black'
  18. });
  19.  
  20. button.style.cssText = 'float: right;';
  21.  
  22. button.style.cssFloat = 'right';
  23.  
  24. button.className = 'a class that matches a pre-written CSS rule-set';
  25.  
  26. //Set Property
  27.  
  28. this.setProperty = function (a, b) {
  29. var c = this.element.getAttribute("style");
  30. var d;
  31. if (!c) {
  32. this.element.setAttribute("style", a + ":" + b);
  33. return;
  34. } else {
  35. d = c.split(";")
  36. }
  37.  
  38. for (var e = 0; e < d.length; e++) {
  39. var f = d[e].split(":");
  40. if (f[0].toLowerCase().replace(/^s+|s+$/g, "").indexOf(a.toLowerCase().replace(/^s+|s+$/g, "")) == 0) {
  41. d[e] = a + ":" + b
  42. }
  43. }
  44.  
  45. d[d.length] = a + ":" + b;
  46. this.element.setAttribute("style", d.join(";"))
  47. }
  48.  
  49. //Remove Property
  50. this.removeProperty = function (a) {
  51. var b = this.element.getAttribute("style");
  52. var c;
  53. if (!b) {
  54. return
  55. } else {
  56. c = b.split(";")
  57. }
  58.  
  59. for (var d = 0; d < c.length; d++) {
  60. var e = c[d].split(":");
  61. if (e[0].toLowerCase().replace(/^s+|s+$/g, "").indexOf(a.toLowerCase().replace(/^s+|s+$/g, "")) == 0) {
  62. c[d] = ""
  63. }
  64. }
  65.  
  66. this.element.removeAttribute("style");
  67. this.element.setAttribute("style", c.join(";").replace(";;", ";"))
  68. }
  69.  
  70. node.style.z-index = 50;/Firefox says error, invalid assignment left hand side.
  71.  
  72. node.style["z-index"] = "50";//Works without error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement