Hey guys,
I would like that when the HTML page loads to my website, if the user enters a word and presses a specific key (e.g. enter). The event should occur on the page and manipulate an object already existing on the page.
Here is an example:
1.) The webpage load
2.) The user enter a word, suppose "cow", and pressed the enter key.
3.) The Image of the cow disappears: cowImg.setAttribute("style", "display:none");

There is no input box where the user enters "cow". It must be done on the page and if the keyword is not followed by the press of the enter key, the event should not occur.

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

There is no input box where the user enters "cow". It must be done on the page and if the keyword is not followed by the press of the enter key, the event should not occur.

Giving an outline is good but without an actual code then it would be hard for anyone to see what you are talking about.

This is doable, but it will require some scripting...
But I see another problem;

You say: "2.) The user entered a word,...", and pressed the enter key".
My question is, -where will the user enter the word?
Given the heads-up that: "There is no input box where the user enters "cow".

Your end-users/clients,-In case that they'll understand (if they understand) the "task" (about being required to type names of things they see on the page), they will also be forced on blind-typing!
Which is, a bad experience, as they say.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.