The name of the iframe can be the target of a link or form. Open the link or form to this iframe.
I encountered an issue before where I couldn’t set the name attribute of an iframe in IE
JavaScript code
var iframe = document.createElement('iframe'); iframe.name = 'ifr'; //iframe.setAttribute('name', 'ifr'); //这样也不行
Neither of the above two methods can be set. Later I found out that it can also be created like this
JavaScript code
var iframe = document.createElement('');
This is no problem in IE, but this method cannot be passed in Firefox. So finally
JavaScript code
try{ var iframe = document.createElement('<iframe name="ifr"></iframe>'); }catch(e){ var iframe = document.createElement('iframe'); iframe.name = 'ifr'; }
This way it is compatible.