Javascript examples for DOM HTML Element:Span
Create <span> element, change its color and append to document
<html> <head></head> <body> ... //from ww w. jav a 2 s.c om ... <script type="text/javascript"> var mySpan = document.createElement("span"); mySpan.innerHTML = "This is my span!"; mySpan.style.color = "red"; document.body.appendChild(mySpan); console.log("hi"); </script> </body> </html>