IE Issue: Submitting form to an iframe using javascript

前端 未结 4 817
滥情空心
滥情空心 2020-12-07 17:44

I was trying to create an iframe element using javascript, like so:

var iframe = document.createElement(\'iframe\');
iframe.setAttribute(\'name\', \'frame_x\         


        
4条回答
  •  猫巷女王i
    2020-12-07 18:34

    To continue @scunliffe’s answer, if using Prototype.js:

    var iframe = Element('iframe', {name: 'frame_x'});
    

    which works because this helper function detects HAS_EXTENDED_CREATE_ELEMENT_SYNTAX for IE, working around the .name = … bug.

提交回复
热议问题