Hello Everyone,

I am new to Javascript and would appreciate any help here. My client has a requirement of a search function which is specific. That is, if a user puts in the word "lexus printer" in the search field the result for that would be "toner123" and it should appear in the same page. Also the result can be same for another search keyword too. For eg. "toner123" could also be the result for "hp printer".

How could I acheive this with JavaScript?

Thanks,

Saktiyantra.

Recommended Answers

All 3 Replies

Just check the textbox value

var x=document.getElementById("txtbax");
x1=x.value;
if(x1 == "lexus printer")
{
x.value="toner123";
}

Hello Everyone,

I am new to Javascript and would appreciate any help here. My client has a requirement of a search function which is specific. That is, if a user puts in the word "lexus printer" in the search field the result for that would be "toner123" and it should appear in the same page. Also the result can be same for another search keyword too. For eg. "toner123" could also be the result for "hp printer".

How could I acheive this with JavaScript?

Thanks,

Saktiyantra.

I think you would like to add some tags too, for every entry you put in the database, as a seperate column in the database.
And your search will compare against this tags too apart from the actual entry name.

Hi,

Thanks for the reply. However, please keep in mind that I am well versed just in HTML and you will have to explain everything in detail. Even the code that would go into the head tag etc.

Thanks

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.