This code make an error. Probably the problem is with location.href apostrophes.
div.innerHTML ='<div id="link">\
<input type="button" onclick="location.href='http://www.google.com';"/>\
</div>';
This code make an error. Probably the problem is with location.href apostrophes.
div.innerHTML ='<div id="link">\
<input type="button" onclick="location.href='http://www.google.com';"/>\
</div>';
You can escape your string like this:
div.innerHTML ='<div id="link">\<input type="button" onclick="location.href=\'http://www.google.com/\';"/>\</div>';