B
bosky101
alright ive heard a lot about the onclick being needing to be replaced
with click ,and some other healthy practices like that . but im still
not able to figure out the problem . my click event is not triggered .
no error shown in javascript console as well . any idea ?
// JavaScript Document
window.addEventListener("load", function() {
var i=0;
draw();
function draw(){
var t = document.createElement("div");
t.innerHTML = "<div id=\"div1\" style=\"margin: 0 auto 0
auto;\"><input name=\"submit\" type=\"submit\" id='btnStart'
value=\"Start\"></div>";
document.body.insertBefore(t, document.body.firstChild);
document.getElementById('btnStart').setAttribute("click",
function()
{start()},false);
}
function start(){
alert('started');
}
},false);
the div1 is shown, but events are not triggered . sometimes i get a
funciton not defined as well.
Keep Clicking,
Bosky
with click ,and some other healthy practices like that . but im still
not able to figure out the problem . my click event is not triggered .
no error shown in javascript console as well . any idea ?
// JavaScript Document
window.addEventListener("load", function() {
var i=0;
draw();
function draw(){
var t = document.createElement("div");
t.innerHTML = "<div id=\"div1\" style=\"margin: 0 auto 0
auto;\"><input name=\"submit\" type=\"submit\" id='btnStart'
value=\"Start\"></div>";
document.body.insertBefore(t, document.body.firstChild);
document.getElementById('btnStart').setAttribute("click",
function()
{start()},false);
}
function start(){
alert('started');
}
},false);
the div1 is shown, but events are not triggered . sometimes i get a
funciton not defined as well.
Keep Clicking,
Bosky