Get Samp Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Samp


The Samp object represents an HTML <samp> element.

You can access a <samp> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<samp id="mySamp">Sample output from a computer program</samp>

<button onclick="myFunction()">set the color of  samp element</button>

function myFunction() {/*w w w  .j  a  v  a  2  s  . c  o m*/
    var x = document.getElementById("mySamp"); = "red";


Related Tutorials