Passing parameters to Javascript Popup window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pavanip
    New Member
    • Mar 2008
    • 53

    #1

    Passing parameters to Javascript Popup window

    Hi,

    I have written the code for display popup window using javascript in button onclient click event.
    Code:
       <asp:Button ID="Button1" runat="server" Style="position: static" OnClientClick="openwindow()"
                    Text="Execute"/>
    <script type="text/javascript">
    function openwindow()
    {
    window.open("AssignedTickets.aspx",'window','width=630,height=620,background=silver,menubar=no, resizable=no')
    }
    </script>
    And I want to pass parameters to that popup page because there are some search parameters i need to pass those to popup page and display the results in popup page.
    Please anybody help me how to pass parameters to popup window using javascript.


    Thanks in Advance
    Pavani
    Last edited by Dormilich; Feb 24 '09, 10:54 AM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    It could be as simple as:
    Code:
    window.open("AssignedTickets.aspx?par=val&par2=val2",...
    PS. please remember to use [code] tags when posting code.

    Comment

    • pavanip
      New Member
      • Mar 2008
      • 53

      #3
      Value is not passing to popup window page

      I used this statement to pass values
      var param1 = document.getEle mentById('textB ox1').value;
      but it dost not passing anything i am getting null value.
      Can you tell me the exact syntax to pass values?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Ah, in that case, you would use:
        Code:
        window.open("AssignedTickets.aspx?param1="+param1,...
        To avoid possible problems with special characters, you may want to wrap 'param1' with encodeURICompon ent().

        Comment

        Working...