0

我有一个 asp 经典下拉框,我需要一个 VBScript 中的 OnClick 事件,以便在从下拉列表中进行选择时显示额外的两个文本字段。

谁能帮我?

我需要先隐藏两个文本字段,然后在请求时显示。

非常感谢,

分子量

'-------------- Date Period ------------------

response.write "<tr><td align='left'>Date Period:</td><td>"
response.write "<select name=tbdateselect id=tbdateselect style='width:160px;'>"
response.write "<option value=''>-</option>"
response.write "<option value=Last Month>Last Month</option>"
response.write "<option value=Last (rolling) Month>Last (rolling) Month</option>"
response.write "<option value=Last 6 Months>Last 6 Months</option>"
response.write "<option value=Last 12 Months>Last 12 Months</option>"
response.write "<option value=Last (rolling) 12 Months>Last (rolling) 12 Months</option>"
response.write "<option value=Date Range>Date Range</option>"
response.write "</select>"
response.write "</td></tr>"

'-------------- Date From --------------------
response.write "<tr><td align='left'>Date From:</td><td>"
response.write "<input type=text name=tbdatefrom size=23 value=''><font color=gray><i> yyyy-mm-dd</i></font></td>"
response.write "</td></tr>"

'------------------ Date To ------------------

response.write "<tr><td align='left'>Date To:</td><td>"
response.write "<input type=text name=tbdateto size=23 value=''><font color=gray><i> yyyy-mm-dd</i></font></td>"
response.write "</td></tr></table><font size=4 color=white>*hiddenfield*</font>"
response.write "</td>"

我需要:如果选项值 = 日期范围,则显示日期从和日期到

4

1 回答 1

0

In my eyes your request is an issue of client side.

1st: If you want to output something to the browser you should never use the server side language as long as is possible. Too many mistakes can be done, especially with quotation.

2nd: If you want to do that without extra server request, you have to use Javascript for that. In example, Jquery or another javascript framework makes it easier. I made an jsfiddle example to demonstrate it.

In case you want do that on server side only -stongly not recommended- you have to do following:

You have to wrap the table into a form. The form has to be always submitted and then you have to get the value from the select box via response.requestForm("tbdateselect"). Then change the html output with an If ... Else .. End If.

于 2013-08-08T15:39:47.147 回答