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