/    Sign up×
Community /Pin to ProfileBookmark

change link colors on a table onClick

Hy guys, I’m writing from Brasil hoping someone could help me out in this.
Here’s the deal:
I need to change the link color of some links inside a table dynamically, with a value retrieved from a textbox. It works like this: the user clicks a link that opens a pop-up with a color picker, and when he chooses the color, the rgb value of the color apears in the textbox. I have a button on the form that triggers the event onClick to change the color of the links inside a table in the same page. I made it work to change the bgcolor of the table, with this:
function changebg() {
document.all.TableName.style.backgroundColor = document.FormName.textBoxName.value;
}
But I need a function that makes the link (not text!) color change, not the bgcolor.
Is there a way to change the value of a class attribute assigning a value to it retrieved from a text input ? Can I do that with all attributes inside a class, like backgroud-image url, and if yes, how can I change it’s attributes onhover ?
Sorry about the several of questions, but I’m crazy with this.
Can someone help me out ?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Adrian 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...