Solved

Style the <td> to only have a border-bottom

Posted on 2008-06-25
1
1,196 Views
Last Modified: 2008-06-25
Through JavaScript I'm able to define the borde style of a <td>-tag by using:
document.getElementById('IDName').style.border = "dashed #123456";

But how do I set the style so that the cell only has a bottom-broder through the use og JavaScript? I've tried the following which gives me an error (Member not found):
document.getElementById('IDName').style = "border-bottom: dashed #123456;";

Here is the html code I would use to give the cell a bottom borser only:
<TD ID='IDName' style='border-bottom-color:#454545; border-bottom-style:dotted;'>
0
Comment
Question by:Tblasters
1 Comment
 
LVL 1

Accepted Solution

by:
bakuretsu earned 250 total points
ID: 21866127
In JavaScript, whenever a style attribute has a hyphen in it, you convert it into camelCase to get the JavaScript property. So, in your case, the "border-bottom" attribute in CSS is called "borderBottom" in JavaScript.

I've placed a version of your code repaired down below.
document.getElementById('IDName').style.borderBottom = "1px dotted #454545";

Open in new window

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now