1 / 8

子母視窗傳值 by JS

子母視窗傳值 by JS. 子母視窗傳值. Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Dim funcWin_Open1 As String funcWin_Open1 = "<Script language=""JavaScript"">"

rhona
Download Presentation

子母視窗傳值 by JS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 子母視窗傳值by JS

  2. 子母視窗傳值 • Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click • Dim funcWin_Open1 As String • funcWin_Open1 = "<Script language=""JavaScript"">" • funcWin_Open1 += "window.open('calendar.aspx?objName=TextBox1','日期','scrollbars=yes,resizable=yes,width=450,height=200');" • funcWin_Open1 += "</Script>" • Response.Write(funcWin_Open1) • End sub

  3. 子母視窗傳值 Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged Dim bb1 As String bb1 = Calendar1.SelectedDate.ToShortDateString() Response.Write("<script>window.opener.document.getElementById('" + Request("ObjName") + "').value='" + bb1 + "';") Response.Write("window.close();") Response.Write("</script>") End Sub

  4. 動態產生物件 & 事件

  5. 動態產生按鈕 Panel 1. 宣告此物件 Dim mybtn As System.Web.UI.WebControls.Button 2. 產生新按按鈕 mybtn = New Button() mybtn.ID = "btn1" mybtn.Text = "123" mybtn.Visible = True Panel1.Controls.Add(mybtn) AddHandler mybtn.Command, AddressOf Button_Command 事件 Protected Sub Button_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Label1.Text = "我是新按鈕" End Sub

  6. 動態產生Table '新增一列 Dim newrow As New TableRow Dim newcell1, newcell2, newcell3 As New TableCell newrow = New TableRow() '新增三欄 newcell1 = New TableCell() newcell2 = New TableCell() newcell3 = New TableCell() newcell1.Text = "a" newcell2.Text = "b" newcell3.Text = "c“ '將欄加入列 newrow.Cells.Add(newcell1) newrow.Cells.Add(newcell2) newrow.Cells.Add(newcell3) '將列併入表格 Table1.Rows.Add(newrow)

  7. 99乘法表練習

  8. 99乘法表 '新增一列 Dim newrow As New TableRow Dim i, j As Integer Dim newcell1 As New TableCell For i = 1 To 8 newrow = New TableRow() '新增欄 For j = 0 To 9 newcell1 = New TableCell() If j = 0 Then newcell1.Text = (i + 1).ToString() Else newcell1.Text = (j * (i + 1)).ToString() End If '將欄加入列 newrow.Cells.Add(newcell1) '將列併入表格 Next Table1.Rows.Add(newrow) Next

More Related