Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  6] [ 2]  / answers: 1 / hits: 103925  / 15 Years ago, sat, april 25, 2009, 12:00:00

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('$connectrn');;
div.appendChild(input);
chat_box.appendChild(div);
}


... but the resulting input does not have onclick property. I tried to use



    input.onclick = conn.send('$connectrn');


... instead, but didn' work either. What am I doing wrong?


More From » input

 Answers
24

Try this:



 input.onclick = function() { conn.send('$connectrn'); };


Steve


[#99644] Monday, April 20, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lonnier

Total Points: 621
Total Questions: 113
Total Answers: 98

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
lonnier questions
;