Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Những tế bào này bảng tương ứng với vị trí của các bảng trong Hình 11-9. Đẹp, thoáng mát, huh? Nhưng mà là tất cả những thứ màu xanh và hình ảnh thể hiện trong hình 11-8? Hình ảnh này chỉ cho thấy cách bố trí. Hãy nhớ rằng tôi đã nói rằng cái nhìn và cảm nhận được chứa trong file css | 344 CHAPTER 12 JAVASCRIPT AND AJAX should have four event handlers for these controls. Listing 12-1 shows the event handlers with the code for these controls. You will need to add the using System.Drawing directive to the top of your page first. Listing 12-1 . Event handlers for the third cell s controls protected void cmdEnter_Click object sender EventArgs e txtText.BackColor Color.Red txtText.ForeColor Color.White protected void cmdChange_Click object sender EventArgs e if cmdChange.Text This Text cmdChange.Text The Other Text else cmdChange.Text This Text protected void rb1_CheckedChanged object sender EventArgs e Clear the list then add item according to this radio button lstList.Items.Clear lstList.Items.Add First 1 rb lstList.Items.Add First 2 rb lstList.Items.Add First 3 rb lstList.Items.Add First 4 rb lstList.Items.Add First 5 rb protected void rb2_CheckedChanged object sender EventArgs e Clear the list then add item according to this radio button lstList.Items.Clear lstList.Items.Add Second 1 rb lstList.Items.Add Second 2 rb lstList.Items.Add Second 3 rb lstList.Items.Add Second 4 rb lstList.Items.Add Second 5 rb You can see that the first cell s Enter button changes the text background and color. This is a common thing to do when validation of the text entry signifies an error. The second button event handler changes the text in the button. You did this for the three time punch projects. The last two radio button event handlers fill the drop-down list with different choices. This kind of thing is also common in web pages. Compile and run the code. Click the second cell s button and you will see the text change. The size of the button will also change to accommodate the text. CHAPTER 12 JAVASCRIPT AND AJAX 345 Type something in the first cell s text box and press its button. The background color of the text box will change to red. If you click the radio buttons you will see the list change values. This page is shown in Figure 12-3. Server Text Box Server B