關閉費勁的查詢視窗@_@10/8

做了一個頁面,有兩個textbox需要開新同樣的一個查詢視窗,選擇資料後將相關值返回到textbox中同時要關閉查詢的小視窗,但是在關閉查詢視窗時不夠順暢

開啟查詢視窗:

1<input onclick="window.open('../base/Qrefer1.aspx?khcode=TextBox3','l10_80','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=500,height=440,left=320,top=140');" type="button" value="..."/>

將查詢視窗的選擇值寫入父視窗的textbox並關閉: Private Sub Button6_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.ServerClick
...

Dim rmark, khcode As String
For inta = 0 To dt.Rows.Count - 1
If dt.Rows(inta).Item(2) = True Then
rmark = rmark & dt.Rows(inta).Item(1) & ";"
End If
Next
If rmark <> "" Then
khcode = Request("khcode")
Response.Write("

1<script language="javascript">window.opener.Form1." & khcode & ".value='" & rmark & "';</script>

")
End If
Response.Write("

1<script language="javascript">window.close();</script>

")

End Sub

p.s.由於要找出每次點選行的資料,所以上面的事件是在後台執行的,有時選擇後執行時要點多次才能關閉,很費勁的;而熱心網友在測試時寫在前台僅一次就可以了,差不多同樣的寫法,前後台有這樣大的差異嗎?

這個還有待於繼續研究。。。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus