New problem- How to change property of different element

admin

Administrator
Staff member
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!You'll need to use Javascript. For example:<script type="text/javascript>
function changeDiv(color)
{
document.getElementById('thediv').style.borderColor = "#"+color;
}
</script>

...

<div id="thediv" style="border: 1px solid #f00;"><a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:changeDiv('0000ff');" title="Change my border color!">Change my border color by clicking here!!!</a></div>
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'.thx dude!No problemo! :)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>
 
Back
Top