Javascript examples for DOM HTML Element:Variable
You can create a <var> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a VAR element with some text</button> <script> function myFunction() {//from w w w. ja va 2s.co m var x = document.createElement("VAR"); var t = document.createTextNode("Some text.."); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>