473,216 Members | 1,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

Dynamically changing a paragraph to make it Bold

Hello everyone. I want to change the style of a HTML element. I can change the paragraph alignment to left right, justify etc. But I can seem to find the code for any other style change, for example to make a paragraph bold.

Expand|Select|Wrap|Line Numbers
  1. <p id="changealignment" class="javaw5" document.getElementByID("changealignment");>This is another paragraph.
  2. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer sed justo. Mauris ullamcorper risus nec elit. Mauris varius lacus in mauris. Sed lacinia aliquet felis. Nam lacinia tortor at orci. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer sed justo. Mauris ullamcorper risus nec elit. Mauris varius lacus in mauris. Sed lacinia aliquet felis. Nam lacinia tortor at orci.</p>
  4. <button type = "button" onclick="document.getElementById('changealignment').style.textAlign='left'">
  5. Submit - Left</button>
  6. <button type = "button" onclick="document.getElementById('changealignment').style.textAlign='right'">
  7. Submit - Right</button>
  8. <button type = "button" onclick="document.getElementById('changealignment').style.textAlign='center'">
  9. Submit - Center</button>
  10. <button type = "button" onclick="document.getElementById('changealignment').style.textAlign='justify'">
  11. Submit - Justify</button>
  12. <button type = "button" onclick="document.getElementById('changealignment').style.bold">
  13. Embolden</button>
  14. <hr width = "100%">
How can i use a button to make the above paragraph Bold? Thank you.
Aug 16 '07 #1
3 2618
5,821 Expert 4TB
Heya, Jonnie.

To make the text bold, you would use:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('changealignment').style.fontWeight = 'bold';
Aug 16 '07 #2
ty. that worked. :D
Aug 19 '07 #3
5,821 Expert 4TB
Heya, Jonnie.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Aug 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Free-Ed, Ltd. | last post by:
I am going nuts trying to find a paragraph in a book that described how to change the text content (HTML) in a DIV. Actually I have an array of HTML strings that I want to drop into the DIV,...
by: Tim | last post by:
Hi Guys, I want to build a font like so: headerFont = new Font("Times New Roman", 10, FontStyle.Underline | FontStyle.Bold); It is going to be built dynamically from the DB. How do I build...
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
by: andreas | last post by:
A selected text has fontstyles like bold and italic and underscore I want to remove one of them without changing the other fontstyles. How to do that? Thanks for any response
by: Byomokesh | last post by:
Hi, I have problem facing in Linking Tags. Linking are 3 types. <!-- Just remark Id --> :( 1. Pref02fn1 <!-- This footnote text move to paragraph in place of link tags. --> 2....
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed...
by: Greg Scharlemann | last post by:
I'm not sure the best way to accomplish this... my hunch is with javascript, but I'm not sure if using server side code (PHP) would be easier. I'm adding people to a database. People have a...
by: bettiahamit | last post by:
here i created sequence no. with every paragraph line .. like... <p local_id = P-100>aaaaaaaaaaaaaaaaaaaaaaaaa<\p> <p local_id = P-101>bbbbbbbbbbbbbbbbbbbbbbbbb<\p> <p local_id =...
by: shivasusan | last post by:
Hi! I can add rows with inputs to my HTML table dynamically using DOM, but I cannot remove selected rows. In fact, every row contains a Delete button. So, user selects the rows to remove, clicks...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.