请大家帮忙看个表单提交的问题!!!

ming6424 2005-11-11 11:47:53
<td align="left" width="560">
<select name=".sx"id="sex"><option value="">[Select]
<option value="m">
Male
<option value="f">
Female</select>
</td>


这个应该如何提交???
...全文
126 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Waiting4you 2005-11-14
  • 打赏
  • 举报
回复
每调用一次QueryInterface记得要idp->Release();上面的偶忘写了
Waiting4you 2005-11-14
  • 打赏
  • 举报
回复
IHTMLSelectElement::put_selectedIndex

HRESULT put_selectedIndex(
long v
);

Selects an item in the list box or drop-down list associated with the select object.

Returns S_OK if successful, or an error value otherwise.
v
Value specifying the zero-based index of the item to select.
Options in a select object are indexed in the order in which they are defined, starting with an index of 0. You can set the selectedIndex property at any time. The display of the select object updates immediately when you set the selectedIndex property. Both forms of the syntax specify the same value.

编这个东东要看MSDN的,悟空,你看了吗?
IHTMLSelectElement *select=NULL;
...
rlt3 = idp->QueryInterface(__uuidof(IHTMLSelectElement),(void **)&select);
if(rlt3=S_OK)
{
select->put_selectedIndex(1);//1==Male,2=Female
}
ming6424 2005-11-11
  • 打赏
  • 举报
回复
说错了
应该是怎样进行选择???
只是提交了,但没有选择啊

Waiting4you(毛毛) ( )
再帮忙看看
Waiting4you 2005-11-11
  • 打赏
  • 举报
回复
id="sex"?呵呵,下面的代码本来和你这个代码是一起的,上次问的是怎么填写,所以没发出来.
提交是这样地:
放到for (long j = 0; j < i; ++j)循环里
IHTMLFormElement *wform=NULL;
if(rlt2==S_OK)
{
wform->get_name(obnm);
txt=AnsiString(*obnm).LowerCase();
if(txt=="theform")//你的form的名字
wform->submit();
}
或者模拟按键,不过这个方法我也没试成功过
ming6424 2005-11-11
  • 打赏
  • 举报
回复
实话实说
我没看明白

IDispatch *idp;
HRESULT rlt1,rlt2;
BSTR *obnm = new BSTR;
BSTR *obval = new BSTR;
AnsiString sTxt;
for (long j = 0; j < i; ++j)
{
Variant index = j;
elc->item(index, index, &idp);
rlt1 = idp->QueryInterface(IID_IHTMLInputElement,(void **)&input);

idp->Release();
if (rlt1 == S_OK)
{
input->get_name(obnm);
sTxt = AnsiString(*obnm).LowerCase();
if (sTxt=="hobby")
{
*obval = WideString("ymao").c_bstr();
input->put_value(*obval);
}
}
......
}

这个可以用于填写文本框,但选择的应该如何做呢???
CACACACACA 2005-11-11
  • 打赏
  • 举报
回复
不知明白没,其实b.asp没有收到任何HTML页的信息,这里只是一例子.详细的看看ASP和HTML的书.
CACACACACA 2005-11-11
  • 打赏
  • 举报
回复
b.asp如下

<%''本程序文件名为:Pages.asp%>
<%''包含ADO常量表文件adovbs.inc,可从"\Program Files\Common Files\System\ADO"目录下拷贝%>
<!--#Include File="adovbs.inc"-->
<%''*建立数据库连接,这里是MSSQL数据库
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Book"

Set rs=Server.CreateObject("ADODB.Recordset") ''创建Recordset对象
rs.CursorLocation=adUseClient ''设定记录集指针属性
''*设定一页内的记录总数,可根据需要进行调整
rs.PageSize=10

''*设置查询语句
StrSQL="Select * from cust"
rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText
%>
<HTML>
<HEAD>
<title>分页示例</title>
<script language=javascript>
//点击"[第一页]"时响应:
function PageFirst()
{
document.MyForm.CurrentPage.selectedIndex=0;
document.MyForm.CurrentPage.onchange();
}
//点击"[上一页]"时响应:
function PagePrior()
{
document.MyForm.CurrentPage.selectedIndex--;
document.MyForm.CurrentPage.onchange();
}
//点击"[下一页]"时响应:
function PageNext()
{
document.MyForm.CurrentPage.selectedIndex++;
document.MyForm.CurrentPage.onchange();
}
//点击"[最后一页]"时响应:
function PageLast()
{
document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
document.MyForm.CurrentPage.onchange();
}
//选择"第?页"时响应:
function PageCurrent()
{ //Pages.asp是本程序的文件名
document.MyForm.action='b.asp?Page='+(document.MyForm.CurrentPage.selectedIndex+1)
document.MyForm.submit();
}
</Script>
</HEAD>
<BODY bgcolor="#ffffcc" link="#008000" vlink="#008000" alink="#FF0000"">

<%IF rs.Eof THEN
Response.Write("<font size=2 color=#000080>[数据库中没有记录!]</font>")
ELSE
''指定当前页码
If Request("CurrentPage")="" Then
rs.AbsolutePage=1
Else
rs.AbsolutePage=CLng(Request("CurrentPage"))
End If

''创建表单MyForm,方法为Get
Response.Write("<form method=Get name=MyForm>")
Response.Write("<p align=center><font size=2 color=#008000>")
''设置翻页超链接
if rs.PageCount=1 then
Response.Write("[第一页] [上一页] [下一页] [最后一页] ")
else
if rs.AbsolutePage=1 then
Response.Write("[第一页] [上一页] ")
Response.Write("[<a href=javascript:PageNext()>下一页</a>] ")
Response.Write("[<a href=javascript:PageLast()>最后一页</a>] ")
else
if rs.AbsolutePage=rs.PageCount then
Response.Write("[<a href=javascript:PageFirst()>第一页</a>] ")
Response.Write("[<a href=javascript:PagePrior()>上一页</a>] ")
Response.Write("[下一页] [最后一页] ")
else
Response.Write("[<a href=javascript:PageFirst()>第一页</a>] ")
Response.Write("[<a href=javascript:PagePrior()>上一页</a>] ")
Response.Write("[<a href=javascript:PageNext()>下一页</a>] ")
Response.Write("[<a href=javascript:PageLast()>最后一页</a>] ")
end if
end if
end if

''创建下拉列表框,用于选择浏览页码
Response.Write("第<select size=1 name=CurrentPage onchange=PageCurrent()>")
For i=1 to rs.PageCount
if rs.AbsolutePage=i then
Response.Write("<option selected>"&i&"</option>") ''当前页码
else
Response.Write("<option>"&i&"</option>")
end if
Next
Response.Write("</select>页/共"&rs.PageCount&"页 共"&rs.RecordCount&"条记录</font><p>")
Response.Write("</form>")

''创建表格,用于显示
Response.Write("<table align=center cellspacing=1 cellpadding=1 border=1")
Response.Write(" bordercolor=#99CCFF bordercolordark=#b0e0e6 bordercolorlight=#000066>")

Response.Write("<tr bgcolor=#ccccff bordercolor=#000066>")

Set Columns=rs.Fields

''显示表头
For i=0 to Columns.Count-1
Response.Write("<td align=center width=200 height=13>")
Response.Write("<font size=2><b>"&Columns(i).name&"</b></font></td>")
Next
Response.Write("</tr>")
''显示内容
For i=1 to rs.PageSize
Response.Write("<tr bgcolor=#99ccff bordercolor=#000066>")
For j=0 to Columns.Count-1
Response.Write("<td><font size=2>"&Columns(j)&"</font></td>")
Next
Response.Write("</tr>")

rs.movenext
if rs.EOF then exit for
Next

Response.Write("</table>")

END IF
%>
</BODY>
</HTML>
CACACACACA 2005-11-11
  • 打赏
  • 举报
回复
<html>
<head>
BCB的主页!欢迎...
</head>
<body>
<form method="post" action="b.asp">
姓名<input type="text" value="填入你的姓名" name="hobby" size="20"><br>
地址<input type="text" name="addr" ><br>
邮编<input type="test" name="zip" size="6"><br>
<input type="submit" name="提交" value="发送">
<input type="reset" name="重设">
</form>
</body>
</html>
ming6424 2005-11-11
  • 打赏
  • 举报
回复
怎么看不到???

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧