So I'm new with JavaScript (this is actually my first attempt to make something work) and I'm having a bit of trouble.
(所以我是JavaScript的新手(这实际上是我第一次尝试做某事)并且我遇到了一些麻烦。)
I thought I had enough knowledge to make this work, I've even googled for tutorials and scripts that could help me work this out but nothing really helped.(我认为我有足够的知识来完成这项工作,我甚至用Google搜索了可以帮助我解决问题的教程和脚本,但没有任何帮助。)
I can't seem to change the image source, heres the code that I have so far:
(我似乎无法更改图像源,这是我到目前为止的代码:)
<script type="text/javascript">
function changeImage(a) {
document.getElementById("img").src=a.src;
}
</script>
<div id="main_img">
<img id="img" src="1772031_29_b.jpg">
</div>
<div id="thumb_img">
<img src='1772031_29_t.jpg' onclick='changeImage("1772031_29_b.jpg");'>
<img src='1772031_55_t.jpg' onclick='changeImage("1772031_55_b.jpg");'>
<img src='1772031_53_t.jpg' onclick='changeImage("1772031_53_b.jpg");'>
</div>
Could anyone please explain if I'm doing something wrong?
(任何人都可以解释我是否做错了什么?)
Or maybe I'm missing something?(或者也许我错过了什么?)
Help me please :-)(请帮帮我 :-))
ask by Alvaro Arregui translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…