Try using an input element (see it on jsFiddle):
var button = document.createElement('input');
button.setAttribute('name', 'write');
button.setAttribute('type', 'button');
button.setAttribute('class', 'ui-button_S40button');
button.setAttribute('style', 'width: 100px;');
button.setAttribute('value', 'Write');
document.getElementById("write_testi").appendChild(button);
Or assign the innerText DOM attribute (demo):
var button = document.createElement('button');
button.setAttribute('type', 'button');
button.setAttribute('name', 'write');
button.setAttribute('class', 'ui-button_S40button');
button.setAttribute('style', 'width: 100px;');
document.getElementById("write_testi").appendChild(button);
button.innerText="Write";
namethis way works fine for me.. jsfiddle.net/uTXBCnameandinnerHTML?