onclick handler

JS,onclick,handler

by codeSpy

HTML

<div id="registerButtonDiv"></div>

JavaScript

var element = document.createElement("input");
//Assign different attributes to the element. 
element.type = 'button';
element.value = 'hello'; // Really? You want the default value to be the type string?
element.name = 'HELLO';  // And the name too?
element.onclick = function(){
    window.open('test.html?name=test&surname1=test2&surname2=test4', 'my_new_window');
};

var foo = document.getElementById("registerButtonDiv");
//Append the element in page (in span).  
foo.appendChild(element);