To get a collection of element we use the getElementsByName() method.Then we can use it to reference individual elements using indexes [0,1,2,...].But i have an example where name attribute is directly used to indicate an iframe element.This is a new thing to me.I don't know what to google to find some articles about it.Can anyone explain to me what it is and under which circumstances i can use this type of reference method.
i mean here mask.document.designMode
is directly using the name attribute to reference the ifram.Shouldn't it be document.getElementById('mask').document.designMode
?
My code enables the designmode for the iframe element.It works in my browsers but not sure why not working in SO's editor.
function iframeOn(){
mask.document.designMode='on';
}
<iframe name='mask' id='mask' onload='iframeOn();' style='border:1px solid black;width:700px;height:300px;word-wrap:break-word;padding-left:2px;padding-right:2px;padding-bottom:2px;overflow-y:scroll;' ></iframe>