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.

The Complete Guide: Make your PVC Quena Flute

Why I started making flutes and a little history about quena flute ... Quena Flute Made in Singapore O.o Let's make Quena! Planning to get a Handy dandy notebk?   This will be a long post.. step by step  .. on making a quena flute. I will provide you with my personal secret handy-dandy tips n tricks, hopefully they will be useful for your flute making. And also I've included the making plans and dimensions for my flute. Don't worry if you do not own any heavy machines or milling machines.. I just find whatever tools I can get around me to make my PVC flute. In another words all the tools that I will be using should be easily obtainable. Yeah!

Six Free Best Word Cloud maker online

I was reading about info-graphics on the web the other day and manage to stumble upon this. Have always loved word art: calligraphy, ambigram.. etc If you like word art and collage , you would probably like this. Being able to form word clouds from a paragraph of text can be very fun and useful at times, especially when you want to have a quick understand about the words density, the frequency of each word, by the means of colours, shapes, size, font type etc. Here I have a six online free word cloud generators that allow you to create your own word collage. Ever wonder how can you make this? Fear not! There are free online software that allows you to create your own word cloud. A url Word Collage of soundatventure.blogspot.com