Website Search Button Code

SEO Help and Tips

Create Website Search Button ?

Web Search Button Code:

HTML:

      <div id='searcherrorpage'>
         <form expr:action='data:blog.homepageUrl + &quot;search/&quot;' id='search-errorpage' method='get'>
            <input id='s' name='q' onblur='if (this.value == &quot;&quot;) {this.value = &quot;Search...&quot;;}' onfocus='if (this.value == &quot;Search...&quot;) {this.value = &quot;&quot;;}' size='40' type='text' value='Search...'/>
<input id='searchsubmit' type='submit' value='Go'/>
         </form>
      </div>
    </div>
</b:if> 

Python code:

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def search_error_page():
    return render_template('search_error.html')

if __name__ == '__main__':
    app.run()

Html:
<div id='searcherrorpage'>
    <form action="{{ data.blog.homepageUrl }}search/" id='search-errorpage' method='get'>
        <input id='s' name='q' onblur="if (this.value == '') {this.value = 'Search...';}" onfocus="if (this.value == 'Search...') {this.value = '';}" size='40' type='text' value='Search...'/>
        <input id='searchsubmit' type='submit' value='Go'/>
    </form>
</div>

Java:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@SpringBootApplication
public class SearchErrorPageApplication {

    public static void main(String[] args) {
        SpringApplication.run(SearchErrorPageApplication.class, args);
    }
}

@Controller
class SearchErrorController {
  
    @GetMapping("/")
    public String searchErrorPage(Model model) {
        String homepageUrl = "https://example.com"; // Replace with your desired URL

        model.addAttribute("homepageUrl", homepageUrl);
        return "search_error";
    }
}

Html:
<div id="searcherrorpage">
    <form action="${homepageUrl}search/" id="search-errorpage" method="get">
        <input id="s" name="q" onblur="if (this.value == '') {this.value = 'Search...';}" onfocus="if (this.value == 'Search...') {this.value = '';}"" size="40" type="text" value="Search..."/>
        <input id="searchsubmit" type="submit" value="Go"/>
    </form>
</div>

Comments

Popular posts from this blog

Office Tool_SPSS v23 + Serial key

How to Fix FATAL error Failed to parse input Document ?

How to Reduce Lazy Load Resources

Popular posts from this blog

Office Tool_SPSS v23 + Serial key

How to Fix FATAL error Failed to parse input Document ?

How to Reduce Lazy Load Resources