FAQ: Learn HTML: Script - The <script> tag

This community-built FAQ covers the “The tag” exercise from the lesson “Learn HTML: Script”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

FAQs on the exercise The tag

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

why doesn’t this code work like it should? The Codeacademy logo appears to be like words on a page so when i scroll over it I have the ability to highlight. I click on it and it isn’t very fast in response. It appears to be flashing the flower.png instead of appearing upon a click.

2 Likes

The first time you click there will be a delay while the image is downloaded. After that it is instant.

1 Like

I haven’t seen any instant reactions. is this due to my browser compatibility or wifi connection?

1 Like

I’m getting instant responses when clicking directly on the word. There may be some latency on the first click, but after that the image is cached in your browser and should pop right up, or right out.

1 Like

Where that “normal” in - if (image.src.match(“normal”)) { - comes from? Does “normal” refer to “normal.png”? Sounds to me like juggling with words - if normal–>flowers, else—> normal.

1 Like

.match() just checks if “normal” is present in the current image src attribute.
If not present it returns null.

So everytime onclick ,

   if  "normal" is present in current img src attribute,
          image will be changed to   flower.png
   else 
          image  will be changed to normal.png.

In other words,
everytime onlcick image src attribute is changed either from flower.png to normal.png or vice versa.

Hope this helps.

For more clarification refer https://stackoverflow.com/questions/25022660/explain-image-src-match-in-javascript