全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2075
推到 Plurk!
推到 Facebook!

請問如何模擬在網頁上填資料送出的動作阿..

尚未結案
liang-shien
一般會員


發表:15
回覆:21
積分:7
註冊:2005-05-26

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-31 11:45:20 IP:61.230.xxx.xxx 未訂閱
我想再我的程式上放一個button和text edit,還有一個webbrowser,這個browser連的網址也是有一個button和text edit.現在就是想讓使用者在我的程式上填資料後按下這個button後等於在browser上填資料按下送出依樣...有人知道要怎麼做嗎?謝謝
supman
尊榮會員


發表:29
回覆:770
積分:924
註冊:2002-04-22

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-05-31 13:34:41 IP:61.70.xxx.xxx 未訂閱
您好: 以下有許多範例,參考看看. http://delphi.ktop.com.tw/topic.php?topic_id=21505 http://delphi.ktop.com.tw/topic.php?topic_id=30154 http://delphi.ktop.com.tw/topic.php?topic_id=28813 http://delphi.ktop.com.tw/topic.php?topic_id=28873 http://delphi.ktop.com.tw/topic.php?topic_id=42261 http://delphi.ktop.com.tw/topic.php?topic_id=47975 http://delphi.ktop.com.tw/topic.php?topic_id=18695 http://delphi.ktop.com.tw/topic.php?topic_id=47086 發表人 - supman 於 2005/05/31 13:59:10
liang-shien
一般會員


發表:15
回覆:21
積分:7
註冊:2005-05-26

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-05-31 14:53:15 IP:61.230.xxx.xxx 未訂閱
可是我現在的網頁上面的button好像是用javascript寫的ㄝ..因為我按右鍵看他的原始碼時,都看不到那個button,只看到寫了兩行javascript...這樣要怎麼辦呢..能強制這個form座送出的動作嗎
alanktop
一般會員


發表:7
回覆:21
積分:5
註冊:2005-03-01

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-06-05 23:16:46 IP:219.134.xxx.xxx 未訂閱
可以安装WSockExpert这个软件,然后你可以启动它,并点击网页上的按钮,可以捕捉到该按钮作了什么样的Post动作。于是在程序中也使用Post方法送出这些数据即可完全达到效果。 请看下面的例子: http://www.tdcenterprise.com/cgi-bin/hkei.dll/Jsp/hkei/g_search_result_r.jsp 在Search栏里输入“CD Player”,点击“go”按钮 被捕获到的数据如下: POST /cgi-bin/hkei.dll/Jsp/hkei/g_search_result_r.jsp HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Referer: http://www.tdcenterprise.com/cgi-bin/hkei.dll/Jsp/hkei/g_search_result_r.jsp Accept-Language: zh-cn Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Host: www.tdcenterprise.com Content-Length: 100 Connection: Keep-Alive Cache-Control: no-cache Cookie: BV_IDS=ccchadddkkkglgecgegcfhedglidfji.0:@@@@0306527526.1108449904@@@@; browserID=browserID=37A0B0D672D2 haveInput=true&ChangeFlag=yes&query=CD Player&target=pca&Region=ALL&Region=ALL&image.x=17&image.y=11 真正有用的就是上面这段数据: haveInput=true&ChangeFlag=yes&query=CD Player&target=pca&Region=ALL&Region=ALL&image.x=17&image.y=11 代码如下: PostData := VarArrayCreate([0, Length(Form1.readjava) - 1], varByte); Data := VarArrayLock(PostData); try Move(Form1.readjava[1], Data^, Length(Form1.readjava)); finally VarArrayUnlock(PostData); end; URL := Form1.readbuttonfield; Flags := EmptyParam; TargetFrameName := EmptyParam; Headers := EmptyParam; // TWebBrowser will see that we are providing // post data and then should automatically fill // this Headers with appropriate value Form1.WebBrowser1.Navigate2(URL, Flags, TargetFrameName, PostData, Headers); 在这里,变量URL即:http://www.tdcenterprise.com/cgi-bin/hkei.dll/Jsp/hkei/g_search_result_r.jsp PostData即:haveInput=true&ChangeFlag=yes&query=CD Player&target=pca&Region=ALL&Region=ALL&image.x=17&image.y=11
paste
一般會員


發表:13
回覆:19
積分:6
註冊:2005-04-27

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-06-07 05:20:22 IP:59.120.xxx.xxx 未訂閱
發表人 - paste 於 2005/06/07 14:48:01
系統時間:2024-04-24 0:31:12
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!