onclick в FF
пишу user.js, код
var input12 = document.createElement("input"); input12.type = 'button'; input12.id = 'input12'; input12.value = "SAVE"; sDiv.appendChild(input12); document.body.appendChild(sDiv); в Опере input12.onclick = function(){ф-ция} работает, а в ФФ нет, в какую сторону копать? |
должно работать, скорее всего проблема где-то в другом месте, до этого кода просто не доходит выполнение
|
через тот-же редактор js в FF6 - работает, а в юзерскрипте с кодом
var sDiv = document.createElement("DIV");
sDiv.style.width = '60px';sDiv.style.height = '200px';sDiv.style.position = 'absolute';sDiv.style.top = '0px';
var input12 = document.createElement("input");
input12.type = 'button';
input12.id = 'input12';
input12.value = "SAVE";
sDiv.appendChild(input12);
document.body.appendChild(sDiv);
input12.onclick = function(){alert('111');}
- нет |
А addEventListener работает?
|
Цитата:
var my_global_hook = function()
{
alert("works");
}
document.addEventListener('onclick', my_global_hook, true);
реакции 0 |
.addEventListener('click'...
|
var sDiv = document.createElement("DIV");
sDiv.style.width = '60px';sDiv.style.height = '200px';sDiv.style.position = 'absolute';sDiv.style.top = '0px';
var input12 = document.createElement("input");
input12.type = 'button';
input12.id = 'input12';
input12.value = "SAVE";
sDiv.appendChild(input12);
document.body.appendChild(sDiv);
var mouseClick = function() {
alert('true');
}
input12.addEventListener("click", mouseClick, true);
вот так работает, всем спасибо |
| Часовой пояс GMT +3, время: 05:09. |