Hi

I have a link, which triggers a script, but when the link is clicked, i want it to get a border around it... currently tried using

onclick="this.style.borderWidth = 1px"

but no luck,

lworks

Recommended Answers

All 4 Replies

maybe you not getting the current reference in this.
Did you tried like below-

document.getElementById('elem_id').style.border-width = '1px';

hi, i gave that a shot, but i am pretty sure the border reference is borderWidth....?!

still no joy

of course, thats because your border doesn't have a color for you to see it, you sould set the bordercolor also. Or assign a previously defined class instead. it keeps things cleaner.

awesomeness... i did already have a border declared in my stylesheet, but setting the class name with this.className sorted it out. thanks dude, lifesaver!

lworks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.