I am creating a user input at one of the events:
var throwConnectBox = function() {
chat_box = document.getElementById('box');
div = window.parent.document.createElement('div');
input = window.parent.document.createElement('input');
input.type = "submit";
input.value = "Join chat";
input.onclick = "conn.send('$connect\r\n');";
div.appendChild(input);
chat_box.appendChild(div);
}
... but the resulting input does not have onclick property. I tried to use
input.onclick = conn.send('$connect\r\n');
... instead, but didn' work either. What am I doing wrong?
Try this:
Steve
I think you may want to escape the \r\n, if you intend to pass these...
I don't quite see what your onclick handler tries to achieve...
There is a problem with one of your lines here; I've corrected it for you:
Does that make more sense?
This is one of the reasons why I've decided to use jQuery: