Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to change image source using javascript

document.getElementById("myImg").src = "hackanm.gif";
Comment

js code to change a immage

<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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript keywords 
Javascript :: read data from json using node 
Javascript :: return early pattern for functions javascript 
Javascript :: disable copy past jquery 
Javascript :: angular route change scroll to top 
Javascript :: javascript checkbox checked event 
Javascript :: js map value in range 
Javascript :: promises basic structure 
Javascript :: how can we redirect to third party page in angular 
Javascript :: get number of creeps screeps 
Javascript :: how to update angular version 
Javascript :: get img src javascript 
Javascript :: get current scroll height javascript 
Javascript :: mongoose required 
Javascript :: find the words separated by whitespace in a string javascript 
Javascript :: disable split screen react native 
Javascript :: javascript split by newline 
Javascript :: jsconfig alias 
Javascript :: javascript date today dd mm yyyy 
Javascript :: how to generate random character from an array js 
Javascript :: stop next script when ajaxcall 
Javascript :: how to extend a type in jsdoc 
Javascript :: mongodb instruction 
Javascript :: set empty to input date js 
Javascript :: button click javascript 
Javascript :: bq show pretty json 
Javascript :: Error: open failed: EACCES (Permission denied) react native 
Javascript :: How to focus on the marker position with zoom in react using react-google-maps 
Javascript :: stun server 
Javascript :: js inner text 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =