Last active
August 29, 2015 14:11
-
-
Save xincici/a1ad8913058d0fa66360 to your computer and use it in GitHub Desktop.
创建一个指定name属性的iframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createIframe(fname){ | |
if(!fname || typeof fname !== 'string'){ | |
return document.createElement('iframe'); | |
} | |
var ifr = null; | |
try{ | |
ifr = document.createElement('<iframe name=' + fname + '></iframe>'); | |
}catch(e){ | |
ifr = document.createElement('iframe'); | |
ifr.name = fname; | |
} | |
return ifr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment