Javascript examples for DOM HTML Element:Samp
The Samp object represents an HTML <samp> element.
You can access a <samp> element by using getElementById():
<!DOCTYPE html> <html> <body> <samp id="mySamp">Sample output from a computer program</samp> <button onclick="myFunction()">set the color of samp element</button> <script> function myFunction() {/*w w w .j a v a 2 s . c o m*/ var x = document.getElementById("mySamp"); x.style.color = "red"; } </script> </body> </html>