- Microsoft Expression Web 教程
- MS Expression Web - 首頁
- MS Expression Web - 概述
- 環境設定
- MS Expression Web - 新建網站
- 空白網頁
- 網頁佈局
- MS Expression Web - HTML 佈局
- 水平導航
- 垂直導航
- MS Expression Web - 驗證頁面
- 動態網頁模板
- MS Expression Web - 搜尋頁面
- MS Expression Web - 圖片
- MS Expression Web - 超連結
- MS Expression Web - 影片
- SQL 資料來源
- MS Expression Web - MS Word
- MS Expression Web - 網格檢視
- MS Expression Web - 主頁
- MS Expression Web - 資料表
- MS Expression Web - 釋出
- 備份網站
- MS Expression Web - 附加元件
- MS Expression Web 資源
- MS Expression Web - 快速指南
- MS Expression Web - 資源
- MS Expression Web - 討論
Microsoft Expression Web - 搜尋頁面
本章將學習如何在網站中新增搜尋選項或搜尋框。對於大型網站,需要在網站中新增搜尋框,以便使用者可以輕鬆找到任何資料。有很多免費的搜尋引擎可用,例如 Windows Live、Google 等。
Windows Live 搜尋
以下步驟將向您展示如何將 Windows Live 搜尋框新增到您的網頁,然後設定搜尋表單以搜尋整個網路或僅搜尋您的網站。
步驟 1 - 建立一個新的 HTML 頁面並將其命名為 SearchPage。
步驟 2 - 轉到“格式”選單,然後選擇動態網頁模板 → 附加動態網頁模板…選項。選擇 master.dwt 檔案並單擊“開啟”按鈕。
步驟 3 - 讓我們在可編輯區域內新增以下程式碼。
<form method = "get" action = "http://search.live.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.live.com/">
<img src = "http://search.live.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>
步驟 4 - 儲存頁面。轉到“檔案”選單,然後選擇“在瀏覽器中預覽”。
步驟 5 - 您將在網頁中看到 Windows Live 搜尋。讓我們在搜尋中輸入一些內容,然後單擊“搜尋網站”按鈕。
步驟 6 - 您會看到它將在網路上進行搜尋。如果您想將搜尋限制在您的網站上,則必須在以下名稱中指定您的網站域名,而不是 www.microsoft.com/expression
<input type = "hidden" name = "q1" value = "site:http://www.microsoft.com/expression"/>
步驟 7 - 同樣,您可以透過在可編輯區域中新增以下程式碼來新增 Google 搜尋選項。
<form method = "get" action = "http://www.google.com/search">
<div style = "border: 1px solid 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 align = "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>
</div>
</form>
步驟 8 - 儲存您的 HTML 頁面,您將看到一個搜尋框、搜尋按鈕、複選框和複選框標籤。
步驟 9 - 要限制使用者只搜尋您的網站,請選擇複選框,然後轉到“標籤屬性”面板並將“值”屬性設定為您的網站 URL,例如 www.microsoft.com/expression。
步驟 10 - 儲存您的頁面並在瀏覽器中預覽。現在您將在網頁中看到 Google 搜尋選項。
廣告