Skip to main content

How to switch or change image in blog post when clicked

Mr Durian is back! woo~
Someone wrote in a comment the other day requesting for a tutorial on How to make the revealing evolving picture in my mini point click game "The Mysterious Letter".
So here I am doing my little coding session again. ~

This should be very easy if you have some knowledge in coding. The code I use down here is straight forward and simple to understand.

But first let me show you another example of what the code does. Click on the picture below and you will see our cute Pikachu evolve. Pika!


  Pikachu

Gotcha!! I bet 90% of you must be thinking Raichu haha.

Anyway this is the code that I am using.

<img alt="Text" height="240" onclick="this.src='http://ImageAfterClick.jpg'" src="http://ImageBeforeClick.jpg" width="320" />

Same as before you'll need to switch over to the HTML mode.

  1. Copy the code in the blue box & paste it into your post 
  2. You have to change those highlighted text:
    • Text (This is the text for image alternate attribute tag. Lets say for whatever reason the picture cant be rendered this "text" will be shown. Write something that is shown in the image)
    • ImageAfterClick.jpg (Url of the image that you want after clicking)
    • ImageBeforeClick.jpg (Url of the image that before receiving the click)
    • (If you want to you can change the hight and width also)

  3. And your post is now ready for publishing
Oh ya! Before i go off .. one last thing you can also use .gif files as your image. It works too! Reload the page and see the example again if you need to...

Comments

  1. so, how to go back to the first image after image was clicked?

    ReplyDelete
  2. Hi jenna. You'll need to refresh the page again, the are no other ways to revert back to the first image after clicking for this piece of code.

    ReplyDelete

Post a Comment

Thanks for reading my post =)
Leave a comment or like our facebook!
Do come back again as I will make every effort in replying your message as soon as possible!

Popular posts from this blog

What is SEO? The really basic definition

I've been talking about SEO on my blog for quite a long time but some are still unsure of what SEO exactly is about.. So for the benefits of those beginners who wants to know more about web page ranking or want to gain more traffics to your blog/site. This is something that you will want to know. The word "SEO" is an acronym that stands for Search Engine Optimization .   First let's breakup the words into two segments and understand what each of them means.

Soup Restaurant (三盅两 件) at IMM

Heh.. I should have done this review earlier.. anyway... If you are a herbal soup enthusiast. If you are looking for a dining place where your old folks can enjoy. then this might be it~ Soup Restaurant is a Cantonese themed eatery that offers Heritage Cuisine that were served in the Chinatown night bazaar in the 1960s~ Soup Restaurant's cantonese name sam zhong leung khin (三盅 两  件 - three bowls two dishes), is a derivation of a popular Cantonese expression  yat zhong leung khin  (一盅 两  件 - one bowl two dishes) which signifies a relaxed lifestyle of consuming teas and dim sum dishes at tea houses in the early morning. 

What is This Green green Profile Picture About

Some of you may be wondering why your friends' profile pictures are becoming green on social network platform ..facebook, twitter or may be some others.. This is not some technical glitch.. This is an ongoing protest to show support for the special effect VFX industry.