Look what is published:

Show more
Try Desktop

How to make my own search engine

A simple code for making your own search engine which can do searches in multiple search engines (Google, Bing, Yahoo etc) simultaneously.  

-----------------------------------------------------
<form id="searchForm">
        <input type="text" id="queryInput" placeholder="Enter your search query">
        <input type="submit" value="Search">
    </form>

    <div id="resultsContainer"></div>

    <script>
        document.getElementById('searchForm').addEventListener('submit', function(e) {
            e.preventDefault();
            var query = document.getElementById('queryInput').value;
            search(query);
        });

        function search(query) {
            // Perform search and fetch results

            // Replace the following code with your search implementation
            // This is just a placeholder

            var searchResults = [
                { 
                    engine: 'Google',
                    results: [
                        { title: 'Result 1 from Google', url: 'https://example.com/result1', description: 'Description of result 1 from Google' },
                        { title: 'Result 2 from Google', url: 'https://example.com/result2', description: 'Description of result 2 from Google' }
                    ]
                },
                { 
                    engine: 'Bing',
                    results: [
                        { title: 'Result 1 from Bing', url: 'https://example.com/result1', description: 'Description of result 1 from Bing' },
                        { title: 'Result 2 from Bing', url: 'https://example.com/result2', description: 'Description of result 2 from Bing' }
                    ]
                }
            ];

            displayResults(searchResults);
        }

        function displayResults(results) {
            var container = document.getElementById('resultsContainer');
            container.innerHTML = ''; // Clear previous results

            results.forEach(function(engine) {
                var engineHeading = document.createElement('h2');
                engineHeading.textContent = engine.engine + ' Results';
                container.appendChild(engineHeading);

                engine.results.forEach(function(result) {
                    var resultDiv = document.createElement('div');

                    var titleLink = document.createElement('a');
                    titleLink.href = result.url;
                    titleLink.textContent = result.title;

                    var descriptionPara = document.createElement('p');
                    descriptionPara.textContent = result.description;

                    resultDiv.appendChild(titleLink);
                    resultDiv.appendChild(descriptionPara);
                    container.appendChild(resultDiv);
                });
            });
        }
    </script>
----------------------------------------------------------------------------------

Comments

Purchase from

Ask a Question

Free Travel Tours

Discover More Tours

ENGLISH SPANISH FRENCH

Explore More Languages

IMMIGRATION OPPORTUNITY

Find Immigration Tips

HOTEL & RESTAURANT REVIEW

Check Hotel & Restaurant Reviews

HI CHICAS ! VAMOS DE TU GUSTO !

Join the Fun!

Shop-In-Solution!

Shop Now
Enhance Your Success with Increased Visitor Engagement!
Ready to leave your mark? Partner with us and witness your business flourish!

How to Find Articles Relevant to Your Interest.

Top Internet Search Topics.

Join Our Writing Community!

🚀✍️ Embrace your passion for words and turn your free time into an exciting writing adventure & earning! Collaborate with us and elevate your writing game. 🌟

🚀✍️ Explore the world of guest writing and enjoy the added bonus of a backlink to your blog. Let's create captivating content together! 🌟

Scan QR code. Buy me a coffee.

Enjoying This Website?

Give Us Your Vote!

Follow Us on Facebook

Follow Us on Facebook

Follow Us Now!

Buy & Sell Your Video

If you have an interesting video and want to earn money from it, then contact us.

Learn a Language for Travel, PR, or Citizenship

Hindi English Spanish French

Offer Your Own Language