How to change style properties for CSS?
I am using the following script segment in an HTML/JS widget:
var a=document.createElement("a");
a.innerHTML=feed.value.items[t].title;
a.style.fontSize=tagSize;
a.style.color=tagColor;
a.href=feed.value.items[t].link;
a.target="_blank";
$.theFeed.appendChild(a);
While the "a" link gets created with appropriate href and target, the two lines to change the fontSize and color do not seem to take effect. I checked tagSize and tagColor and they are both good. I also tried swapping specific values in and it still didn't work.
Is there some other way to access the style settings? Thanks, Ian
var a=document.createElement("a");
a.innerHTML=feed.value.items[t].title;
a.style.fontSize=tagSize;
a.style.color=tagColor;
a.href=feed.value.items[t].link;
a.target="_blank";
$.theFeed.appendChild(a);
While the "a" link gets created with appropriate href and target, the two lines to change the fontSize and color do not seem to take effect. I checked tagSize and tagColor and they are both good. I also tried swapping specific values in and it still didn't work.
Is there some other way to access the style settings? Thanks, Ian
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?if tagSize and tagColor aren't strings it might not be working properly for you. You set styles like so:
a.style.fontSize = "12px";
a.style.color = "#000";
Does this help? If not, where have you defined tagSize and tagColor?
Loading Profile...



