Home All Groups Group Topic Archive Search About

ClientScript working in IE but not in Mozilla

Author
11 Jun 2009 3:39 AM
RuthG
I have date text boxes on my page and am trying to fill them from a pop up
calendar window. I can display the popup in both IE and Mozilla Firefox, when
I click in the text box. Here is the code to display it:

<input ID="FirstPaymentDate" type="text" runat="server"  
onclick="javascript:calendar_window=window.open('calendar.aspx?formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus()"/>

But when I select a date from the calendar, my code fills in the date in my
textbox and closes the calendar in IE, but not in Mozilla. The lines of code
are being processed when I step through them with the debugger, but nothing
is happening. Here is the VB.Net code:

    Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
        Dim strjscript As String
        strjscript = "window.opener." &
HttpContext.Current.Request.QueryString("formname") & ".value = '" &
Calendar1.SelectedDate & "';window.close();"
       ClientScript.RegisterStartupScript(Me.GetType(),
Guid.NewGuid().ToString, strjscript)
    End Sub

Instead of the last line, I also tried putting the script in a literal to
execute when it is rendered:
Literal1.Text = "<script language=""javascript"">" & strjscript & "</script"
& ">"

I also tried to register an on submit and had a submit button on the
calendar form:
ClientScript.RegisterOnSubmitStatement(Me.GetType(),
Guid.NewGuid().ToString, strjscript)

Nothing happened in all these cases.

I think the problem may be a security setting in Mozilla, but I can't find
it. Java scripts and their debugging is enabled. Blocking or unblocking pop
up windows makes no difference. Any suggestions? I want this code to work in
all browsers.

Author
11 Jun 2009 4:06 AM
RuthG
I changed the following line, to let ClientScript add a script wrapper:
       ClientScript.RegisterStartupScript(Me.GetType(),
Guid.NewGuid().ToString, strjscript, true)

(I had previously tried it with the old RegisterStartupScript and had added
the wrapper, but when I changed to the new version, I though it wasn't
needed.)
It didn't make a difference. Still, nothing happening.

Show quoteHide quote
"RuthG" wrote:

> I have date text boxes on my page and am trying to fill them from a pop up
> calendar window. I can display the popup in both IE and Mozilla Firefox, when
> I click in the text box. Here is the code to display it:
>
>  <input ID="FirstPaymentDate" type="text" runat="server"  
> onclick="javascript:calendar_window=window.open('calendar.aspx?formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus()"/>
>
> But when I select a date from the calendar, my code fills in the date in my
> textbox and closes the calendar in IE, but not in Mozilla. The lines of code
> are being processed when I step through them with the debugger, but nothing
> is happening. Here is the VB.Net code:
>
>     Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
> System.EventArgs)
>         Dim strjscript As String
>         strjscript = "window.opener." &
> HttpContext.Current.Request.QueryString("formname") & ".value = '" &
> Calendar1.SelectedDate & "';window.close();"
>        ClientScript.RegisterStartupScript(Me.GetType(),
> Guid.NewGuid().ToString, strjscript)
>     End Sub
>
> Instead of the last line, I also tried putting the script in a literal to
> execute when it is rendered:
> Literal1.Text = "<script language=""javascript"">" & strjscript & "</script"
> & ">"
>
> I also tried to register an on submit and had a submit button on the
> calendar form:
> ClientScript.RegisterOnSubmitStatement(Me.GetType(),
> Guid.NewGuid().ToString, strjscript)
>        
> Nothing happened in all these cases.
>
> I think the problem may be a security setting in Mozilla, but I can't find
> it. Java scripts and their debugging is enabled. Blocking or unblocking pop
> up windows makes no difference. Any suggestions? I want this code to work in
> all browsers.
Are all your drivers up to date? click for free checkup

Author
11 Jun 2009 2:19 PM
Adrienne
Gazing into my crystal ball I observed RuthG writing in
<E4E1324D-43EB-4B05-972E-D622208EB***@microsoft.com>:

Show quoteHide quote
> I changed the following line, to let ClientScript add a script wrapper:
>        ClientScript.RegisterStartupScript(Me.GetType(),
>  Guid.NewGuid().ToString, strjscript, true)
>
> (I had previously tried it with the old RegisterStartupScript and had added
> the wrapper, but when I changed to the new version, I though it wasn't
> needed.)
> It didn't make a difference. Still, nothing happening.
>
> "RuthG" wrote:
>
>> I have date text boxes on my page and am trying to fill them from a pop up
>> calendar window. I can display the popup in both IE and Mozilla Firefox, when
>> I click in the text box. Here is the code to display it:
>>
>>  <input ID="FirstPaymentDate" type="text" runat="server"  
>> onclick="javascript:calendar_window=window.open('calendar.aspx?formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus()"/>
>>
Two things, first this is a client side issue, and would be better
discussed in a client side group, like comp.lang.javascript.
Second, this is an ASP Classic group, so you might want to cross post to a
dot net group.
Please be sure to cross post, not multipost.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Bookmark and Share