1.
output: undefined
2.
Why in 1 output undefined?
Code:
newFrame = document.createElement("iframe");
newFrame.id='aa1';
newFrame.onload = aa(this.id);
document.getElementsByTagName('body')[0].appendChild(newFrame);
function aa(id){alert(id);}
2.
Code:
document.write("<br><iframe id = 'aa1' onload = 'aa(this.id)'></iframe>");
function aa(id){alert(id);}
output: aa1
Comment