想要的效果是,按按钮,把图1换成图2.首先为什么不能再本地实现图片的切换,其次,如果图片在服务器,要怎么实现呢? /*--------------------------------------------------------------------------*/ <!DOCTYPE html> <html> <head> <title>changepics</title> <meta charset="utf-8"> <script type="text/javascript"> document.getElementById("change").onclick=function changpics(){ document.getElementById("pic").src="img/2.PNG"; } </script> </head> <body> <input type="button" name="chang" value="点击换图" id="change"> <br> <img src="img/1.PNG" id="pic"> </body> </html>
慕粉3456840