<html>
<head>
<title>HTMLElement test</title>
</head>
<body>
<?php
require_once 'htmlelement.class.php';
$div = new HTMLElement('div');//create a main HTMLElement
$p = new HTMLElement('p');//create other HTMLElement
$p->appendChild(new DOMText('Test'));//append text to HTMLElement
$p->setAttribute('style', 'color: green');
$div->appendChild($p);//append child to main HTMLElement
$div->appendChild(new DOMElement('p', 'It\'s Work!'));//append a DOMElement to main HTMLElement
$div->setAttribute('style', 'color: red');
$code = $div->getCode();//get HTML code
echo $code;//show HTMLElement
highlight_string($code);//show source-code
?>
</body>
</html>
|