DOM appendChild to insert images

前端 未结 1 1590
天命终不由人
天命终不由人 2021-01-04 18:27

I have this code that creates links.

   /* Create a link to activate the tab */
    DOM_a = document.createElement(\"a\");
    DOM_a.appendChild(document.cre         


        
相关标签:
1条回答
  • 2021-01-04 18:51

    You should create the image using own DOM methods too:

    Something like this:

    var DOM_img = document.createElement("img");
    DOM_img.src = "typo3conf/ext/ori_proyectos/res/images/interes.png";
    
    DOM_a.appendChild(DOM_img);
    

    A working example here.

    0 讨论(0)
提交回复
热议问题