Window.opener issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frickeme
    New Member
    • Nov 2007
    • 1

    Window.opener issue

    I have an asp page that uses javascript
    Code:
    <textarea rows="2" cols="20" name="emailto" ID="Textarea2"><%=emailto%></textarea><input type="button" onclick="javascript:window.open('page2.aspx?returnto=document.form1.Textarea2&forms=yes&Action=EmailTo','', 'width=600px,height=400px,scrollbars=1,top=100');" value=">" name="findemail" ID="Button2">
    The window pops up (aspx page) and has a textbox, they enter a name and search, then the results are displayed in a datagrid. The datagrid has a template column that is a link. When they click the link I want a particular value to go back to the asp page and display in a textbox. Here is the code for the link. I put this in the datagrid item command and when e.commandname = select it will run.
    Code:
    Dim valretto As String = Request.QueryString("returnto")
                    Dim current As String = Request.QueryString("current")
                    TxtValue.Text = e.Item.Cells(3).Text
                    Dim strjscript As String = "<script language=""javascript"">"
                    strjscript &= "window.opener.getelementbyID(" & valretto & ") = '" & TxtValue.Text & "" + "," + " " & current & " ';window.opener(" & valretto & ".focus();self.close();"
                    strjscript &= "</script>"
                    Literal1.Text = strjscript
                    e.Item.Cells(0).Attributes.Add("onclick", "strjscript;self.close();")
    I can see it gets the correct value but it does not close the window and pass it back to the first page. When I take off to display errors I get an error Microsoft JScript runtime error: Object doesn't support this property or method. I added the .getelementbyID and now I get an error form1 is undefined.
    Is this something to do with the textarea?

    Thanks!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    JavaScript is case-sensitive. You should be using document.getEle mentById(). Note the capital E, capital B and lower-case D.

    Comment

    Working...