cannot load >

前端 未结 4 1062
日久生厌
日久生厌 2021-01-29 06:17

I\'m implementing as simple image gallery.

This is what I got for now

function init(){
  var elem = document.createElement(\"img\");

  elem.scr=\'upload         


        
相关标签:
4条回答
  • 2021-01-29 06:45

    you have a typo in your code:

    elem.src='upload/creative-design-modern-furniture.jpg';
      //  ^---- was 'scr' in your code
    
    0 讨论(0)
  • 2021-01-29 06:54

    You have a typo when you're setting the source. Instead of elem.scr it should be elem.src.

    0 讨论(0)
  • 2021-01-29 06:58

    You have probably made a typo, using scr="..." instead of src="....".

    I highly suggest that you use some element inspectors in browsers such as firebug (Mozilla Firefox), DragonFly (Opera) or Chrome built-in tool to check how the code is finally formed in the page when loaded and easily locate those types of errors. They are easy to use, they allow you to test and make such modifications in html/js/css on-the-fly and they can save you a lot of time.

    0 讨论(0)
  • 2021-01-29 07:01

    You have made typo

    elem.scr='upload/creative-design-modern-furniture.jpg';
    

    should be

    elem.src='upload/creative-design-modern-furniture.jpg';
    
    0 讨论(0)
提交回复
热议问题