
function create(form,document)
{
var name = form.name.value,
price = form.price.value,
currency = form.currency.value,
output = form.output;
var topLevel = getTopLevel(document);
var elementProduct = document.createElement(“product”);
elementName = document.createElement(“name”),
elementPrice = document.createElement(“price”);
elementPrice.setAttribute(“currency”,currency);
var text = document.createTextNode(name);
elementName.appendChild(text);
text = document.createTextNode(price);
elementPrice.appendChild(text);
elementProduct.appendChild(elementName);
elementProduct.appendChild(elementPrice);
topLevel.appendChild(elementProduct);
output.value = “”;
output.value ...