Create a Samp Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Samp


You can create a <samp> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create a SAMP element with some text</button>

function myFunction() {//  w w w .  ja v  a  2 s  .  c om
    var x = document.createElement("SAMP");
    var t = document.createTextNode("Sample output from a computer program");


Related Tutorials