Hi all,
I am using javascript to open a window after a button is pressed. Everything about the window works correctly, I am wondering if anyone knows a way to give the child window the focus that is cross browser compatible. Here is the sub I am using:
VB Code:
'used for adding a new contact Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim strScript As String Dim strFeatures As String SupplierInfo.InnerHtml = "" ContactInfo.InnerHtml = "" LinkButton1.Text = "" Linkbutton2.Text = "" cmbContact.Items.Clear() If cmbSupplier.SelectedIndex = 0 Then MessageBox.Show("Please choose a supplier before adding a new contact", _ "Supplier Needed", MessageBoxButtons.OK, MessageBoxIcon.Error, _ MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification) Else strFeatures = "'left=100,top=50,menubar=no,height=750,width=600,resizable=yes," strFeatures += "scrollbars=no,titlebar=yes,toolbar=no'" strScript = "<script language=javascript>" strScript += "window.open('Contact.aspx?ContactID=0&SupplierID=" _ + cmbSupplier.SelectedItem.Value + "','Add New Contact'," & strFeatures & ") " strScript += ";window.focus('Add New Contact')</script>" Response.Write(strScript) End If End Sub




Reply With Quote