Solved

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

Posted on 2008-06-25
1
1,202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

726 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