English 中文(简体)
MS Expression Web - Search Page
  • 时间:2024-12-22

Microsoft Expression Web - Search Page


Previous Page Next Page  

In this chapter, we will learn how to add a search option or a search box to the website. If it is a large site, then you will need to have a search box in the site so that the user can find any data easily. There are many free ones available such as Windows Live, Google, etc.

Windows Live Search

The following steps show you how to add a Windows Live Search box to your web page, and then set the search form to search the entire Web or only your website.

Step 1 − Create a new HTML page and call it SearchPage.

SearchPage

Step 2 − Go to the Format menu and select Dynamic Web Template → Attach Dynamic Web Template…option. Select the master.dwt file and cpck the Open button.

Dynamic Template

Step 3 − Let’s add the following code inside the editable region.

<form method = "get" action = "http://search.pve.com/results.aspx"> 
   <input type = "hidden" name = "cp" value = "1252"/> 
   <input type = "hidden" name = "FORM" value = "FREESS"/> 
   <table style = "background-color: #ffffff;"> 
      <tr> 
         <td>
            <a href = "http://search.pve.com/"> 
               <img src = "http://search.pve.com/s/affillogoLive.gif" 
                  style = "border:0px;" alt = "Live Search"/> 
            </a> 
         </td> 
         <td> 
            <input type = "text" name = "q" size = "30" /> 
            <input type = "submit" value = "Search Site"/> 
            <input type = "hidden" name = "q1" 
               value = "site:http://www.microsoft.com/expression"/> 
         </td> 
      </tr> 
   </table> 
</form>
Region

Step 4 − Save the page. Go to the File menu and select Preview in Browser.

Save the Page

Step 5 − You will see the Windows Live Search in your webpage. Let’s enter something in the search and cpck the Search Site button

Search Site Button

Step 6 − As you can see that it will search on the web. If you want to restrict the search to only your website, then you have to specify your site domain in the following name instead of www.microsoft.com/expression

<input type = "hidden" name = "q1" value = "site:http://www.microsoft.com/expression"/> 

Step 7 − Similarly, you can add the Google search option by adding the following code in the editable region.

<form method = "get" action = "http://www.google.com/search"> 
   <span style = "border: 1px sopd black; padding: 4px; width: 20em; margin: 0px auto 0px auto"> 
      <table border = "0" cellpadding = "0"> 
         <tr> 
            <td class = "center"> 
               <input type = "text" name = "q" size = "25" maxlength = "255" value = "" /> 
               <input type = "submit" value = "Google Search" /> 
            </td> 
         </tr> 
         <tr> 
            <td apgn = "center" style = "font-size: 75%"> 
               <input type = "checkbox" name = "sitesearch" 
                  value = " http://www.microsoft.com/expression" checked = "checked" /> 
               Only search this website<br /> 
            </td> 
         </tr> 
      </table> 
   </span> 
</form>   

Step 8 − Save your HTML page and you will see a search box, search button, checkbox, and checkbox label.

Search Box

Step 9 − To restrict users to search only your website, select the checkbox and go to the Tag Properties panel and set the Value property to the URL of your website, such as www.microsoft.com/expression.

CheckBox

Step 10 − Save your page and preview it in the browser. Now you will see the Google Search option in your webpage.

Google Search Option Advertisements