how to pass a var to a htm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ellen89
    New Member
    • Nov 2007
    • 14

    how to pass a var to a htm

    Hi All,

    I have the following situation:

    There is a link at A.xsl page, onclick this link, would lead to B.htm; onclick=ViewNex tPage().

    Also at A.xsl has a valiable "AccountNum ber" which I want to pass to B.htm.

    in my .js file, I have:

    [CODE=javascript]function ViewNextPage() {
    alert (getquerystring ("AccountNumber "))
    strURL="/.../B.htm"
    showModalDialog ("", strURL, "500", "600")
    alert (getquerystring ("AccountNumber "))
    }[/CODE]

    when running the scipts, I could see two times of the alert showing the value before/after B.htm being displayed.

    now I modify this function as following, try to carry this variable over to B.htm

    [CODE=javascript]function ViewNextPage() {
    var param=getquerys tring("AccountN umber"))
    strURL="/.../B.htm"
    showModalDialog ("", strURL, "500", "600", param)
    }[/CODE]

    this time I have nothing, I even could not see the B.htm.

    Wish somebody here would give me some suggestion. Thank you in advance.
    Last edited by gits; Nov 22 '07, 08:06 AM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Change line 3 to:
    [code=javascript]strURL="/.../B.htm?AccountNu mber="+param;[/code] and then use location.search to get AccountNumber.

    Comment

    • ellen89
      New Member
      • Nov 2007
      • 14

      #3
      acoder, thank you so much. I will try it next Monday.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        OK, let me know how it goes.

        Comment

        • ellen89
          New Member
          • Nov 2007
          • 14

          #5
          acoder,

          Thank you for asking.

          After I changed the code, the B.htm could not being displayed.

          I had tried couple of different ways as following:
          1) [CODE=javascript]function DisplayAuthoriz edSigner(){
          var param
          param = getQueryString( "AccountNumber" ))
          alert(getQueryS tring("AccountN umber"))
          var strURL = "/modules/account/authorized_sign ers/content/authorized_sign er.htm?AccountN umber=" +param
          DisplayModalWin dow("", strURL, "408", "700", param)
          }[/CODE]

          2) [CODE=javascript]function DisplayAuthoriz edSigner(){
          var param
          param = getQueryString( "AccountNumber" ))
          alert(getQueryS tring("AccountN umber"))
          var strURL = "/modules/account/authorized_sign ers/content/authorized_sign er.htm"+"?Accou ntNumber=param"
          DisplayModalWin dow("", strURL, "408", "700", param)
          }[/CODE]

          3) 1) [CODE=javascript]function DisplayAuthoriz edSigner(){
          var param
          param = getQueryString( "AccountNumber" ))
          alert(getQueryS tring("AccountN umber"))
          var strURL = "/modules/account/authorized_sign ers/content/authorized_sign er.htm?AccountN umber=" +param
          DisplayModalWin dow("", strURL, "408", "700")
          }
          [/CODE]
          Regards,
          ellen89
          Last edited by acoder; Nov 26 '07, 03:31 PM. Reason: Added code tags

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Can you show the code for getQueryString( )?

            Comment

            • ellen89
              New Member
              • Nov 2007
              • 14

              #7
              Now this time it is working, when I tried:

              [CODE=javascript]function DisplayAuthoriz edSigner(){

              alert(getQueryS tring("AccountN umber"))
              var strURL = "/modules/account/authorized_sign ers/content/authorized_sign er.htm"+"?Accou ntNumber=" + getQueryString( "AccountNumber" )
              DisplayModalWin dow("", strURL, "408", "700")
              }
              [/CODE]
              Many thanks to you help.

              ellen89
              Last edited by acoder; Nov 26 '07, 04:21 PM. Reason: Added code tags

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Glad you got it working. Post again if you have more questions.

                Comment

                • ellen89
                  New Member
                  • Nov 2007
                  • 14

                  #9
                  Appreciate your time.

                  For sure I will, this is a nice place.

                  ellen89

                  Comment

                  Working...