问题在这里:
我想点击切换背景图片,改变背景图片的路径,具体在下面js代码的注释中
无标题文档






Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
console.log(oMian.style.backgroundImage);始终得到的是第一个图片的地址,不知道怎么回事
oMian.style.backgroundImage = "url("+aLi[n].children[0].getAttribute('src')+")";这样才显示背景图,至于src为什么是绝对路径,这得问js的创始人呀,顺便帮我问问.getAttribute('src')为什么是相对路径(∩_∩)