PDA

View Full Version : Entering Correct Word Into a Search Bar to open up a certain image. Please Help!



Timmy2872
May 15th, 2017, 06:51 PM
Hi Everyone,

A little bit stuck on a current project. i have a website with a Search Bar Feature and i would like it so that when a certain word or words are typed into the search bar it creates a pop up of an image, and if the wrong word is entered it opens a different pop up image.
This maybe a simple thing but it has me baffled.
Please could someone help me so i can finish this already overdue project. Thanks and appreciation in advance

Here is the code for the current Search Bar feature -


<div id="custom-search-input">
<input type="text" class="form-control input-lg" placeholder="Search" />
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="button">
<i class="glyphicon glyphicon-search"></i>
</button>
</span>
</div>

Timmy2872
May 16th, 2017, 07:54 AM
Anybody out there have any ideas for this? I didnt realise this was going to be quite so difficult?

Timmy2872
May 17th, 2017, 01:40 PM
Ok i have now sorted this out by using a simple javascript code as follows -

<script type="text/javascript">
var x = prompt(" Please Enter Company Name With No Spaces Before or After The Name"," ");
if(x=="....................") {
window.location = "/images/approved.png";
}
else {
window.location = "/images/notapproved.png";
}
</script>


The only problem i'm having now is on some devices a space is added to the end of the password or before and its rejecting the password, anyone know the bit of code i need for it to ignore spaces or (white spaces) as i think they are called?

Once again many thanks in advance.