/    Sign up×
Community /Pin to ProfileBookmark

New problem- How to change property of different element

i think thats the right title..:rolleyes:

anyways… i want to make it so that when i move over a link, it changes the border color of a differnt <div>

i figured i could do this with css and the a:hover.

i always thought it was a:hover{middle.border blah}

using the . as a seperator, but im wrong

any help plz???

thank you!

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TMay 28.2004 — You'll need to use Javascript. For example:&lt;script type="text/javascript&gt;
function changeDiv(color)
{
document.getElementById('thediv').style.borderColor = "#"+color;
}
&lt;/script&gt;

...

&lt;div id="thediv" style="border: 1px solid #f00;"&gt;&lt;a href="javascript:changeDiv('0000ff');" title="Change my border color!"&gt;Change my border color by clicking here!!!&lt;/a&gt;&lt;/div&gt;

Note: when you apply the code, remove the space between "java" and "script" in the word "java script" in the anchor tag. It's a glitch that these forums have :rolleyes: And to change the color the border changes to, just put a different value where it has '0000ff'.
Copy linkTweet thisAlerts:
@BoooozeauthorMay 28.2004 — thx dude!
Copy linkTweet thisAlerts:
@Daniel_TMay 28.2004 — No problemo! ?
Copy linkTweet thisAlerts:
@KarmaKillsMay 30.2004 — Thats only going to work when you click on the link. I think he said he wanted it for when you hover over a link. So it should be:

<div id="thediv" style="border: 1px solid #f00;"><a onMouseOver="document.getElementById('thediv').style.borderColor=#00f" onMouseOut="document.getElementById('thediv').style.borderColor=#f00" title="Change my border color!">Change my border color by clicking here!!!</a></div>
×

Success!

Help @Booooze 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.20,
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,
)...