asp中動態預設,asp中動態預設selected

2022-02-22 11:35:52 字數 2605 閱讀 4848

1樓:匿名使用者

先做一個函式:

function object_selected(current_value1,value1)

if current_value1=value1 thensel_str="selected"

else

sel_str=""

end if

object_selected=sel_strend function

之後:在用到預設的地方:

>中山青旅

引數1與引數2,代入用函式即可。

2樓:匿名使用者

<%for i=1949 to 2050

else

response.write ""&i&""

end if

next

%>年<% for i=1 to 12

else

response.write ""&i&""

end if

next

%>月<% for i=1 to 31

else

response.write ""&i&""

end if

next

%>日

高手請進!asp中select的預設選中問題?

3樓:匿名使用者

do while not rs1.eof

if rs1("res_name")="補考" thensel="selected"

else

sel=""

end if

%>" <%=sel%>> <%=rs1("res_name")%>

4樓:

" selected> <%=rs1("res_name")%>

在需要預設選中的標籤里加一個selected就行了。

5樓:三太狼童裝

slct=""

if rs1("res_name")="補考" then slct="selected=""selected"""" <%=slct%>> <%=rs1("res_name")%>

6樓:匿名使用者

" <% if rs1("res_name")='補考' then%>selected<% end if%>> <%=rs1("res_name")%>

換掉"> <%=rs1("res_name")%>

asp如何在後臺設定select選中項,越簡單越好。 <%aspget***%> 這種的

7樓:匿名使用者

原理不是一樣的嗎?

資料庫查詢語句比如這樣:select [id],[name] from [dbname]

將函式 aspgetoption 的返回值與一項值判斷。

比如與id值欄位判斷,**如下:

"<% if aspgetoption=rs(0) then %> selected="selected"<% end if %>><%=rs(1)%>

如果你的下拉選單項是固定寫在頁面上的,而非資料庫裡提取的,那麼,原理還是和上面一樣的。

8樓:老王談網際網路

理解樓主意思,你完全可以用asp來實現

<%set rs=conn.execute("select id from [dbname]")

do while not rs.eof

if request("query")=rs(0) thencheckselect="selected"

else

checkselect=""

end if

rs.movenext

loop

%>

高手請進!asp中select的預設選中問題?

9樓:

<%do while notrs1.eof%>" <%if(rs1("res_id")=003)%>> <%=rs1("res_name")%>

<%rs1.movenext

loop

%>

asp中的option中的selected的使用

10樓:開發者之路

改成:" <>><%=rs(1)%>

11樓:匿名使用者

改成下面的:

"<%if rs(1)=timu_type then%> selected="selected"<%end if%>><%=rs(1)%>

測試ASP動態頁

不要使用dw預覽,開啟瀏覽器,輸入127.0.0.1 asp 就好.要是不行,你的iis設定就有問題.實在不行,你就在網上下一個 asp迷你伺服器 很多的.把它放在asp檔案路徑下,先開啟asp迷你伺服器,進行簡單設定檔案路徑 在瀏覽器上輸入127.0.0.1 asp 就ok了.我最近也在學習asp...

編寫HTML靜態網頁和ASP動態網頁,在靜態網

假設你的登陸表單的文字框id為username 密碼框為password 在asp頁面接收值 dim username,password username request.form username password request.form password 在下面判斷 if username o...

在asp中trim是什麼意思,在ASP中,trim是什麼意思

去掉字串兩邊的空格,無論有多少個,但需要主要不會取消字串中間的空格。trim 是去掉字串兩端的空格 比如 trim word 將得到 word 去掉一個字串左右的空格符 字串中間的不會被去掉 例如字串abc 1 2 3 則trim abc 1 2 3 trim是去掉字串前後的空格 將字串左右邊的空格...