/    Sign up×
Community /Pin to ProfileBookmark

how to edit a tag in another tag?

Hi ppl ?

My problem is, i want to edit the size of the TD-tag which is in a DIV-tag
(not all TD’s in the site, only from [B][U]one[/U][/B] DIV)

i tried something like this:

[CODE]
for (var i = 0; i < document.getElementById(“content”).length; i++) {
document.getElementsByTagName(“td”)[i].style.fontSize = size;
}
[/CODE]

.. it doesnt work, and i dont get error from firebug in mozilla…
can anybody help me? ?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@snowiekenFeb 24.2009 — If you somehow can give all those TD's an id, it's a lot more simple, then you can access them via getElementById(). But I get the feeling that this is somehow impossible?

Try

<i>
</i>var tds = document.getElementById("content").getElementsByTagName("td");

for (var i = 0; i &lt; tds.length; i++) {
tds[i].style.fontSize = size;
}


getElementById() returns just one element and therefore doesn't have a length method.
Copy linkTweet thisAlerts:
@ZarinaauthorFeb 24.2009 — hey @snowieken :eek:

thank youuu verrrryyy muchh, it works ?

:rolleyes::p
×

Success!

Help @Zarina spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...