Your Ad Here

Posted By

WillItWork on 05/29/07


Tagged

css js textmate work-around


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

basicmagic
vali29


setStyleById


 / Published in: JavaScript
 

URL: http://developer.apple.com/internet/webcontent/styles.html

Free, and cool! This gets aroung JS's issues with changing CSS styles on the fly.

  1. /* From Apple: http://developer.apple.com/internet/webcontent/styles.html
  2.  setStyleById: given an element id, style property and
  3.  value, apply the style.
  4.  args:
  5.   i - element id
  6.   p - property
  7.   v - value
  8. */
  9.  
  10. function setStyleById(i, p, v) {
  11. var n = document.getElementById(i);
  12. n.style[p] = v;
  13. }

Report this snippet  

You need to login to post a comment.