Home  >  Article  >  Web Front-end  >  javascript event binding issues_javascript skills

javascript event binding issues_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:12:36973browse

Sub-page HTML:

Copy code The code is as follows:




Sub-page JS:
Copy code The code is as follows:

function CreateIOC(text,value) {
var o = document.createElement("a");
o.id = value;
o.href = "#";
o.className = "c";
o.style.border = "2px solid red";
o.style .width = "250px";
o.style.height = "30px";
o.style.display = "block";
o.innerHTML = "< ;td>" text "< /tr>
";
o.setAttribute("onclick", "iocClick()");
return o;
}
function iocClick() {
alert ('ok');
}
function CheckedBox(box) {
window.parent.document.getElementById("kdks_panel").appendChild(CreateIOC('1','2'));
}

Parent HTML:
Copy code The code is as follows:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn