2007年11月26日 星期一

Lab 16: Form and Action

"logic will get you from A to B - imagination will take you anywhere"

How to use Form to invoke a remote service through CGI.


1. Copy the search box of this search page,
inlcuding radio buttons, text input, and submit button.
複製搜尋引擎
2. Open your Nvu HTML editor.
3. Open a new empty HTML file.
4. Paste the search box into this new file.
打開Nvu,並將上步驟所複製之網頁貼上.

5. Use Nvu to add a Form to this search box. Do not hand code the HTML. Just fill the blank in the Form dialog.
選擇下面的HTML標籤,看看有沒有Form,如果沒有則要自己定義.


6. In the form dialog, set Action="http://google.com/search" and name of Form as "f" and method as "get"
(See Hint if it does not work.)
如果沒有form需要自己定義時,選擇插入--->表單--->定義表單
於表單名稱輸入:f
Action URL輸入:http://google.com/search
Method 選擇:get
然後確定即可.


7. Run your HTML by Firefox. What do you get?
檔案--->另存新檔--->儲存
於剛儲存的檔案用firefox開啟
會看見先前的google網頁

可以搜尋
(隨便輸入字來搜尋)


8. Set method as "post"
這次將先前的merhod改為post


9. Run your HTML by Firefox. What do you get?
無法搜尋

沒有留言: