0
我正在尝试更改另一图像的图像源。如何在javascript中更改源图像?
<script type="text/javascript">
document.getElementById("imgbulb").onclick= function() {
document.getElementById("imgbulb").Src ="C:\Html\images\ bbc.png";
}
</script>
可能是欺骗:http://stackoverflow.com/questions/7312553/change-image-source-with-javascript在你的情况下,尝试使用小写的'src'。 –
我已经尝试过使用小写'src',但没有奏效。 –
您的浏览器是沙箱版,并且无法访问您的本地文件系统,如“C:\ Html \ images \ bbc.png”。试试像“file:// relative-path-to-file”。 –