Javascript examples for DOM HTML Element:Bold
You can create a <b> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a B element with text</button> <script> function myFunction() {/* w w w. ja v a2s. co m*/ var x = document.createElement("B"); var t = document.createTextNode("Some bold text"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>