Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change border-style onmouseover 1

Status
Not open for further replies.

glenmac

Technical User
Jul 3, 2002
947
CA
Hi I want to change the border style onmouseover. I can change background like this:
Code:
<script>
function changeBorder(FieldName)
{
    document.all[FieldName].style.background = "skyblue";
}
function changeBorder1(FieldName)
{
    document.all[FieldName].style.background = "lightblue";
}


</script>
html:
Code:
<div id = "logo1" name = "logo1" onmouseover="changeBorder('logo1')" onmouseout="changeBorder1('logo1')">
but if I change "background" to "border-style" it doesn't work. I want change border-style from inset to outset. The border style is set to inset by my style sheet. I know I've seen this done before. All help will be greatly appreciated!

Glen
 
Thanks for the reply cLFlaVA ! tried
Code:
function changeBorder(FieldName)
{
    document.FieldName.style.borderStyle = "inset";
}
no worky,, guessI'm misunderstanding you

Glen
 
glen,

with your implicit reference, you'd need FieldName to be an id. try this instead:

Code:
document.getElementById("MyElementId").style.borderStyle = "inset";

this assumes your element has an id of MyElementId. Also, keep in mind that inset/outset border styles only appear when the color allows it - I don't believe it works for black.

Here's another (inline) example:

Code:
<div onmouseover="this.style.borderStyle='dotted';"
     onmouseout="this.style.borderStyle='solid';"
     style="border: 1px solid black;">stuff goes here</div>
<br />
<div onmouseover="this.style.borderStyle='inset';"
     onmouseout="this.style.borderStyle='outset';"
     style="border: 3px outset gray;">stuff goes here</div>



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top