Author Topic: Javascript  (Read 4208 times)

Canuck

  • Eh?!!
  • Founders
  • Posts: 792
  • Karma: +51/-3
  • Andy Moog Fan
    • My Website
Javascript
« on: November 10, 2005, 11:54:28 AM »
I tried searching the net, and couldnt find anything.

document.getElementById('id').style.border = '2px solid green';

I am trying to change only the bottom border to green, but I cant figure out a way to just target the bottom border.  Is there a way to accomplish this?

Thanks

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Javascript
« Reply #1 on: November 10, 2005, 01:23:53 PM »
document.getElementById('id').style.border-bottom = '2px solid green';

That's the CSS attribute.. I'm only assuming you can do the same through JS.

Canuck

  • Eh?!!
  • Founders
  • Posts: 792
  • Karma: +51/-3
  • Andy Moog Fan
    • My Website
Javascript
« Reply #2 on: November 10, 2005, 01:28:38 PM »
I thought that would work, and tried border-bottom, and border.bottom, but I get the following error.

Error: invalid assignment left-hand side

I dont know why it wont allow me to specify border-bottom.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Javascript
« Reply #3 on: November 10, 2005, 01:38:00 PM »
I'll do a little testing then...

Canuck

  • Eh?!!
  • Founders
  • Posts: 792
  • Karma: +51/-3
  • Andy Moog Fan
    • My Website
Javascript
« Reply #4 on: November 10, 2005, 01:53:01 PM »
Thanks for trying to figure it out, I appreciate it.  I just found this great site which helped me out.

http://codepunk.hardwar.org.uk/css2js.htm

The following is how the working code looks.

Code: [Select]

document.getElementById('id').style.borderBottomColor = 'green';
document.getElementById('id).style.borderBottomStyle = 'solid';
document.getElementById('id').style.borderBottomWidth = '2px';

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Javascript
« Reply #5 on: November 10, 2005, 01:56:47 PM »
I got this to work:
Code: [Select]






Untitled





This is a test of the border changer.








ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Javascript
« Reply #6 on: November 10, 2005, 01:58:14 PM »
Ah ha... I figured there had to be another way to do it.  :)  Good find.