Forum Moderators: open

Message Too Old, No Replies

JavaScript & Border Property

Can't get it to work?

         

krieves

6:49 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



I know I'm doing something stupid, but I can't figure this out. I trying use a function to change the border property of a <td>. Here is my function:

<script>

function xyz(){
document.all.abc.style.border-left= "2px solid black";
}
</script>

It doesn't work and I can't get the syntax right. I tried "borderleft" and it doesn't work.

Thanks for any help or suggestions.

krieves

6:57 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



Never mind I figured it out.

<script>

function xyz(){
document.all.abc.style.borderLeft= "2px solid black";
}
</script>

Uppercase L on left. Go figure.

tedster

8:40 pm on Oct 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



go figure

You've noticed an important rule about hyphenated css properties and javascript. When you're accessing the css with javascript you always drop the hyphen and capitalize the second word. I often wish it was consistent between the two, but it's not.