473,388 Members | 1,327 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,388 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>
  3.  
  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 2626
pbmods
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';
  2.  
Aug 16 '07 #2
ty. that worked. :D
Aug 19 '07 #3
pbmods
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

10
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,...
6
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...
7
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...
6
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
0
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....
4
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...
3
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...
0
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 =...
29
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.