having an ASP variable in javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • middletree

    having an ASP variable in javascript

    I have a menu that I use on my Intranet app, and while I did try to replace
    it recently, I ended up going back to it. It's built entirely with
    javascript, and works great.

    However, there are certain pages where I would like to be able to put an
    item into a querystring for a link. That is, I might have a link which is
    worded "Add to this ticket" and the hyperlink associated with that text is
    along the lines of "addtoticket.as p?ticketid=1000 "

    I am not able to figure out how to have an ASP variable into a link built by
    javascript. This is the main question. How can I have the ASP variable in a
    javascript?

    Because it's Inranet, I don't have the page to show you. However, I have
    zipped up the two javascript files and placed them at


    Also, in this case, IE-specific code will not be a problem. 100% of users
    are on IE5+


  • Curt_C [MVP]

    #2
    Re: having an ASP variable in javascript

    replace
    addtoticket.asp ?ticketid=1000
    with
    addtoticket.asp ?ticketid=<%=Yo urAspVariable%>

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software



    "middletree " <middletree@hto mail.com> wrote in message
    news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=blue]
    > I have a menu that I use on my Intranet app, and while I did try to[/color]
    replace[color=blue]
    > it recently, I ended up going back to it. It's built entirely with
    > javascript, and works great.
    >
    > However, there are certain pages where I would like to be able to put an
    > item into a querystring for a link. That is, I might have a link which is
    > worded "Add to this ticket" and the hyperlink associated with that text is
    > along the lines of "addtoticket.as p?ticketid=1000 "
    >
    > I am not able to figure out how to have an ASP variable into a link built[/color]
    by[color=blue]
    > javascript. This is the main question. How can I have the ASP variable in[/color]
    a[color=blue]
    > javascript?
    >
    > Because it's Inranet, I don't have the page to show you. However, I have
    > zipped up the two javascript files and placed them at
    > www.middletree.net/js.zip
    >
    > Also, in this case, IE-specific code will not be a problem. 100% of users
    > are on IE5+
    >
    >[/color]


    Comment

    • TomB

      #3
      Re: having an ASP variable in javascript

      <%
      'This is asp so it runs on the server

      Dim aVar
      aVar="1000"
      %>
      <script language="Javas cript">
      //this runs on the client, except for the <%=aVar%> part which gets
      tossed in on the server
      function AddToTicket()
      {
      window.open('th eUrl.asp?id=<%= aVar%>');
      }
      </script>


      "middletree " <middletree@hto mail.com> wrote in message
      news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=blue]
      > I have a menu that I use on my Intranet app, and while I did try to[/color]
      replace[color=blue]
      > it recently, I ended up going back to it. It's built entirely with
      > javascript, and works great.
      >
      > However, there are certain pages where I would like to be able to put an
      > item into a querystring for a link. That is, I might have a link which is
      > worded "Add to this ticket" and the hyperlink associated with that text is
      > along the lines of "addtoticket.as p?ticketid=1000 "
      >
      > I am not able to figure out how to have an ASP variable into a link built[/color]
      by[color=blue]
      > javascript. This is the main question. How can I have the ASP variable in[/color]
      a[color=blue]
      > javascript?
      >
      > Because it's Inranet, I don't have the page to show you. However, I have
      > zipped up the two javascript files and placed them at
      > www.middletree.net/js.zip
      >
      > Also, in this case, IE-specific code will not be a problem. 100% of users
      > are on IE5+
      >
      >[/color]


      Comment

      • middletree

        #4
        Re: having an ASP variable in javascript

        OK, I'll try it. But that was so obvious that I didn't think it would work.


        "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
        news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
        > replace
        > addtoticket.asp ?ticketid=1000
        > with
        > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
        >
        > --
        > Curt Christianson
        > Owner/Lead Developer, DF-Software
        > www.Darkfalz.com
        >
        >
        > "middletree " <middletree@hto mail.com> wrote in message
        > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=green]
        > > I have a menu that I use on my Intranet app, and while I did try to[/color]
        > replace[color=green]
        > > it recently, I ended up going back to it. It's built entirely with
        > > javascript, and works great.
        > >
        > > However, there are certain pages where I would like to be able to put an
        > > item into a querystring for a link. That is, I might have a link which[/color][/color]
        is[color=blue][color=green]
        > > worded "Add to this ticket" and the hyperlink associated with that text[/color][/color]
        is[color=blue][color=green]
        > > along the lines of "addtoticket.as p?ticketid=1000 "
        > >
        > > I am not able to figure out how to have an ASP variable into a link[/color][/color]
        built[color=blue]
        > by[color=green]
        > > javascript. This is the main question. How can I have the ASP variable[/color][/color]
        in[color=blue]
        > a[color=green]
        > > javascript?
        > >
        > > Because it's Inranet, I don't have the page to show you. However, I have
        > > zipped up the two javascript files and placed them at
        > > www.middletree.net/js.zip
        > >
        > > Also, in this case, IE-specific code will not be a problem. 100% of[/color][/color]
        users[color=blue][color=green]
        > > are on IE5+
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • middletree

          #5
          Re: having an ASP variable in javascript

          Didn't work.

          The link is took me to, which should have been
          http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
          http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew

          Syntax error converting the varchar value '<=strTicketID> ' to a column of
          data type int.

          /TicketLog.asp, line 34





          "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
          news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
          > replace
          > addtoticket.asp ?ticketid=1000
          > with
          > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
          >
          > --
          > Curt Christianson
          > Owner/Lead Developer, DF-Software
          > www.Darkfalz.com
          >
          >
          > "middletree " <middletree@hto mail.com> wrote in message
          > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=green]
          > > I have a menu that I use on my Intranet app, and while I did try to[/color]
          > replace[color=green]
          > > it recently, I ended up going back to it. It's built entirely with
          > > javascript, and works great.
          > >
          > > However, there are certain pages where I would like to be able to put an
          > > item into a querystring for a link. That is, I might have a link which[/color][/color]
          is[color=blue][color=green]
          > > worded "Add to this ticket" and the hyperlink associated with that text[/color][/color]
          is[color=blue][color=green]
          > > along the lines of "addtoticket.as p?ticketid=1000 "
          > >
          > > I am not able to figure out how to have an ASP variable into a link[/color][/color]
          built[color=blue]
          > by[color=green]
          > > javascript. This is the main question. How can I have the ASP variable[/color][/color]
          in[color=blue]
          > a[color=green]
          > > javascript?
          > >
          > > Because it's Inranet, I don't have the page to show you. However, I have
          > > zipped up the two javascript files and placed them at
          > > www.middletree.net/js.zip
          > >
          > > Also, in this case, IE-specific code will not be a problem. 100% of[/color][/color]
          users[color=blue][color=green]
          > > are on IE5+
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Mark Schupp

            #6
            Re: having an ASP variable in javascript

            The files where you want to substitute variables are JS files and are not
            processed by ASP. There are a couple of possibilities.

            1. make the js files .asp files and include asp code to set the
            variables.

            2. add a javacript variable declaration to the asp page before including
            the script file. then use that variable in the script file.

            ....
            <script language="javas cript">
            var strTicketID = "<%=YourAspVari able%>";
            </script>

            <script language="javas cript" src="menu.js"></script>
            ....

            in menu.js

            self.location=" addtoticket.asp ?ticketid=" + strTicketID;

            --
            Mark Schupp
            Head of Development
            Integrity eLearning
            Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.



            "middletree " <middletree@hto mail.com> wrote in message
            news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=blue]
            > Didn't work.
            >
            > The link is took me to, which should have been
            > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
            > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
            >
            > Syntax error converting the varchar value '<=strTicketID> ' to a column of
            > data type int.
            >
            > /TicketLog.asp, line 34
            >
            >
            >
            >
            >
            > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
            > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=green]
            > > replace
            > > addtoticket.asp ?ticketid=1000
            > > with
            > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
            > >
            > > --
            > > Curt Christianson
            > > Owner/Lead Developer, DF-Software
            > > www.Darkfalz.com
            > >
            > >
            > > "middletree " <middletree@hto mail.com> wrote in message
            > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=darkred]
            > > > I have a menu that I use on my Intranet app, and while I did try to[/color]
            > > replace[color=darkred]
            > > > it recently, I ended up going back to it. It's built entirely with
            > > > javascript, and works great.
            > > >
            > > > However, there are certain pages where I would like to be able to put[/color][/color][/color]
            an[color=blue][color=green][color=darkred]
            > > > item into a querystring for a link. That is, I might have a link which[/color][/color]
            > is[color=green][color=darkred]
            > > > worded "Add to this ticket" and the hyperlink associated with that[/color][/color][/color]
            text[color=blue]
            > is[color=green][color=darkred]
            > > > along the lines of "addtoticket.as p?ticketid=1000 "
            > > >
            > > > I am not able to figure out how to have an ASP variable into a link[/color][/color]
            > built[color=green]
            > > by[color=darkred]
            > > > javascript. This is the main question. How can I have the ASP variable[/color][/color]
            > in[color=green]
            > > a[color=darkred]
            > > > javascript?
            > > >
            > > > Because it's Inranet, I don't have the page to show you. However, I[/color][/color][/color]
            have[color=blue][color=green][color=darkred]
            > > > zipped up the two javascript files and placed them at
            > > > www.middletree.net/js.zip
            > > >
            > > > Also, in this case, IE-specific code will not be a problem. 100% of[/color][/color]
            > users[color=green][color=darkred]
            > > > are on IE5+
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Curt_C [MVP]

              #7
              Re: having an ASP variable in javascript

              you'll have to show a few more lines of code from this asp

              --
              Curt Christianson
              Owner/Lead Developer, DF-Software



              "middletree " <middletree@hto mail.com> wrote in message
              news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=blue]
              > Didn't work.
              >
              > The link is took me to, which should have been
              > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
              > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
              >
              > Syntax error converting the varchar value '<=strTicketID> ' to a column of
              > data type int.
              >
              > /TicketLog.asp, line 34
              >
              >
              >
              >
              >
              > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
              > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=green]
              > > replace
              > > addtoticket.asp ?ticketid=1000
              > > with
              > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
              > >
              > > --
              > > Curt Christianson
              > > Owner/Lead Developer, DF-Software
              > > www.Darkfalz.com
              > >
              > >
              > > "middletree " <middletree@hto mail.com> wrote in message
              > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...[color=darkred]
              > > > I have a menu that I use on my Intranet app, and while I did try to[/color]
              > > replace[color=darkred]
              > > > it recently, I ended up going back to it. It's built entirely with
              > > > javascript, and works great.
              > > >
              > > > However, there are certain pages where I would like to be able to put[/color][/color][/color]
              an[color=blue][color=green][color=darkred]
              > > > item into a querystring for a link. That is, I might have a link which[/color][/color]
              > is[color=green][color=darkred]
              > > > worded "Add to this ticket" and the hyperlink associated with that[/color][/color][/color]
              text[color=blue]
              > is[color=green][color=darkred]
              > > > along the lines of "addtoticket.as p?ticketid=1000 "
              > > >
              > > > I am not able to figure out how to have an ASP variable into a link[/color][/color]
              > built[color=green]
              > > by[color=darkred]
              > > > javascript. This is the main question. How can I have the ASP variable[/color][/color]
              > in[color=green]
              > > a[color=darkred]
              > > > javascript?
              > > >
              > > > Because it's Inranet, I don't have the page to show you. However, I[/color][/color][/color]
              have[color=blue][color=green][color=darkred]
              > > > zipped up the two javascript files and placed them at
              > > > www.middletree.net/js.zip
              > > >
              > > > Also, in this case, IE-specific code will not be a problem. 100% of[/color][/color]
              > users[color=green][color=darkred]
              > > > are on IE5+
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • middletree

                #8
                Re: having an ASP variable in javascript

                Comments below:

                "Mark Schupp" <mschupp@ielear ning.com> wrote in message
                news:eg2#ygs2DH A.540@tk2msftng p13.phx.gbl...[color=blue]
                > The files where you want to substitute variables are JS files and are not
                > processed by ASP.[/color]

                That was my point in the OP. Guess I didn't communicate it well.
                [color=blue]
                >There are a couple of possibilities.[color=green]
                >> 1. make the js files .asp files and include asp code to set the[/color][/color]
                variables.[color=blue]
                >[/color]
                I have no idea how to do this, or what you mean, exactly.
                [color=blue]
                > 2. add a javacript variable declaration to the asp page before[/color]
                including[color=blue]
                > the script file. then use that variable in the script file.
                >
                > ...
                > <script language="javas cript">
                > var strTicketID = "<%=YourAspVari able%>";
                > </script>
                >
                > <script language="javas cript" src="menu.js"></script>
                > ...
                >
                > in menu.js
                >
                > self.location=" addtoticket.asp ?ticketid=" + strTicketID;
                >[/color]

                Hmm, this looks like something I could do. Let me check and I'll post my
                results.

                thanks very much!



                Comment

                • middletree

                  #9
                  Re: having an ASP variable in javascript

                  Nope. Didn't work.

                  It gave me a link to



                  "Mark Schupp" <mschupp@ielear ning.com> wrote in message
                  news:eg2#ygs2DH A.540@tk2msftng p13.phx.gbl...[color=blue]
                  > The files where you want to substitute variables are JS files and are not
                  > processed by ASP. There are a couple of possibilities.
                  >
                  > 1. make the js files .asp files and include asp code to set the
                  > variables.
                  >
                  > 2. add a javacript variable declaration to the asp page before[/color]
                  including[color=blue]
                  > the script file. then use that variable in the script file.
                  >
                  > ...
                  > <script language="javas cript">
                  > var strTicketID = "<%=YourAspVari able%>";
                  > </script>
                  >
                  > <script language="javas cript" src="menu.js"></script>
                  > ...
                  >
                  > in menu.js
                  >
                  > self.location=" addtoticket.asp ?ticketid=" + strTicketID;
                  >
                  > --
                  > Mark Schupp
                  > Head of Development
                  > Integrity eLearning
                  > www.ielearning.com
                  >
                  >
                  > "middletree " <middletree@hto mail.com> wrote in message
                  > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=green]
                  > > Didn't work.
                  > >
                  > > The link is took me to, which should have been
                  > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
                  > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                  > >
                  > > Syntax error converting the varchar value '<=strTicketID> ' to a column[/color][/color]
                  of[color=blue][color=green]
                  > > data type int.
                  > >
                  > > /TicketLog.asp, line 34
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                  > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
                  > > > replace
                  > > > addtoticket.asp ?ticketid=1000
                  > > > with
                  > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                  > > >
                  > > > --
                  > > > Curt Christianson
                  > > > Owner/Lead Developer, DF-Software
                  > > > www.Darkfalz.com
                  > > >
                  > > >
                  > > > "middletree " <middletree@hto mail.com> wrote in message
                  > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                  > > > > I have a menu that I use on my Intranet app, and while I did try to
                  > > > replace
                  > > > > it recently, I ended up going back to it. It's built entirely with
                  > > > > javascript, and works great.
                  > > > >
                  > > > > However, there are certain pages where I would like to be able to[/color][/color][/color]
                  put[color=blue]
                  > an[color=green][color=darkred]
                  > > > > item into a querystring for a link. That is, I might have a link[/color][/color][/color]
                  which[color=blue][color=green]
                  > > is[color=darkred]
                  > > > > worded "Add to this ticket" and the hyperlink associated with that[/color][/color]
                  > text[color=green]
                  > > is[color=darkred]
                  > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                  > > > >
                  > > > > I am not able to figure out how to have an ASP variable into a link[/color]
                  > > built[color=darkred]
                  > > > by
                  > > > > javascript. This is the main question. How can I have the ASP[/color][/color][/color]
                  variable[color=blue][color=green]
                  > > in[color=darkred]
                  > > > a
                  > > > > javascript?
                  > > > >
                  > > > > Because it's Inranet, I don't have the page to show you. However, I[/color][/color]
                  > have[color=green][color=darkred]
                  > > > > zipped up the two javascript files and placed them at
                  > > > > www.middletree.net/js.zip
                  > > > >
                  > > > > Also, in this case, IE-specific code will not be a problem. 100% of[/color]
                  > > users[color=darkred]
                  > > > > are on IE5+
                  > > > >
                  > > > >
                  > > >
                  > > >[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • middletree

                    #10
                    Re: having an ASP variable in javascript

                    Well, there's no ASP, really. I mean, this menu is built entirely in js. I
                    have the js you can look at in the zip file I mentioned earlier, but on the
                    ASP page, I just have the <script> code which points to the external js
                    file.


                    "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                    news:uDXQi9s2DH A.2868@TK2MSFTN GP09.phx.gbl...[color=blue]
                    > you'll have to show a few more lines of code from this asp
                    >
                    > --
                    > Curt Christianson
                    > Owner/Lead Developer, DF-Software
                    > www.Darkfalz.com
                    >
                    >
                    > "middletree " <middletree@hto mail.com> wrote in message
                    > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=green]
                    > > Didn't work.
                    > >
                    > > The link is took me to, which should have been
                    > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
                    > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                    > >
                    > > Syntax error converting the varchar value '<=strTicketID> ' to a column[/color][/color]
                    of[color=blue][color=green]
                    > > data type int.
                    > >
                    > > /TicketLog.asp, line 34
                    > >
                    > >
                    > >
                    > >
                    > >
                    > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                    > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
                    > > > replace
                    > > > addtoticket.asp ?ticketid=1000
                    > > > with
                    > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                    > > >
                    > > > --
                    > > > Curt Christianson
                    > > > Owner/Lead Developer, DF-Software
                    > > > www.Darkfalz.com
                    > > >
                    > > >
                    > > > "middletree " <middletree@hto mail.com> wrote in message
                    > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                    > > > > I have a menu that I use on my Intranet app, and while I did try to
                    > > > replace
                    > > > > it recently, I ended up going back to it. It's built entirely with
                    > > > > javascript, and works great.
                    > > > >
                    > > > > However, there are certain pages where I would like to be able to[/color][/color][/color]
                    put[color=blue]
                    > an[color=green][color=darkred]
                    > > > > item into a querystring for a link. That is, I might have a link[/color][/color][/color]
                    which[color=blue][color=green]
                    > > is[color=darkred]
                    > > > > worded "Add to this ticket" and the hyperlink associated with that[/color][/color]
                    > text[color=green]
                    > > is[color=darkred]
                    > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                    > > > >
                    > > > > I am not able to figure out how to have an ASP variable into a link[/color]
                    > > built[color=darkred]
                    > > > by
                    > > > > javascript. This is the main question. How can I have the ASP[/color][/color][/color]
                    variable[color=blue][color=green]
                    > > in[color=darkred]
                    > > > a
                    > > > > javascript?
                    > > > >
                    > > > > Because it's Inranet, I don't have the page to show you. However, I[/color][/color]
                    > have[color=green][color=darkred]
                    > > > > zipped up the two javascript files and placed them at
                    > > > > www.middletree.net/js.zip
                    > > > >
                    > > > > Also, in this case, IE-specific code will not be a problem. 100% of[/color]
                    > > users[color=darkred]
                    > > > > are on IE5+
                    > > > >
                    > > > >
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Vilmar Brazão de Oliveira

                      #11
                      Re: having an ASP variable in javascript

                      HI people,
                      Put the asp result in a html hidden element, so afterwards attribute it to
                      javascript variable, thus:
                      <input type="hidden" name="hidTest" value="<%=VarAS P%>">

                      <script>
                      var JsTest = hidTest.value;
                      </script>

                      bye and good luck1

                      --

                      ««««««««»»»»»»» »»»»»»»
                      Vlmar Brazão de Oliveira
                      Desenvolvimento Web
                      HI-TEC
                      "Curt_C [MVP]" <software_AT_da rkfalz.com> escreveu na mensagem
                      news:uDXQi9s2DH A.2868@TK2MSFTN GP09.phx.gbl...[color=blue]
                      > you'll have to show a few more lines of code from this asp
                      >
                      > --
                      > Curt Christianson
                      > Owner/Lead Developer, DF-Software
                      > www.Darkfalz.com
                      >
                      >
                      > "middletree " <middletree@hto mail.com> wrote in message
                      > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=green]
                      > > Didn't work.
                      > >
                      > > The link is took me to, which should have been
                      > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
                      > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                      > >
                      > > Syntax error converting the varchar value '<=strTicketID> ' to a column[/color][/color]
                      of[color=blue][color=green]
                      > > data type int.
                      > >
                      > > /TicketLog.asp, line 34
                      > >
                      > >
                      > >
                      > >
                      > >
                      > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                      > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
                      > > > replace
                      > > > addtoticket.asp ?ticketid=1000
                      > > > with
                      > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                      > > >
                      > > > --
                      > > > Curt Christianson
                      > > > Owner/Lead Developer, DF-Software
                      > > > www.Darkfalz.com
                      > > >
                      > > >
                      > > > "middletree " <middletree@hto mail.com> wrote in message
                      > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                      > > > > I have a menu that I use on my Intranet app, and while I did try to
                      > > > replace
                      > > > > it recently, I ended up going back to it. It's built entirely with
                      > > > > javascript, and works great.
                      > > > >
                      > > > > However, there are certain pages where I would like to be able to[/color][/color][/color]
                      put[color=blue]
                      > an[color=green][color=darkred]
                      > > > > item into a querystring for a link. That is, I might have a link[/color][/color][/color]
                      which[color=blue][color=green]
                      > > is[color=darkred]
                      > > > > worded "Add to this ticket" and the hyperlink associated with that[/color][/color]
                      > text[color=green]
                      > > is[color=darkred]
                      > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                      > > > >
                      > > > > I am not able to figure out how to have an ASP variable into a link[/color]
                      > > built[color=darkred]
                      > > > by
                      > > > > javascript. This is the main question. How can I have the ASP[/color][/color][/color]
                      variable[color=blue][color=green]
                      > > in[color=darkred]
                      > > > a
                      > > > > javascript?
                      > > > >
                      > > > > Because it's Inranet, I don't have the page to show you. However, I[/color][/color]
                      > have[color=green][color=darkred]
                      > > > > zipped up the two javascript files and placed them at
                      > > > > www.middletree.net/js.zip
                      > > > >
                      > > > > Also, in this case, IE-specific code will not be a problem. 100% of[/color]
                      > > users[color=darkred]
                      > > > > are on IE5+
                      > > > >
                      > > > >
                      > > >
                      > > >[/color]
                      > >
                      > >[/color]
                      >
                      >[/color]


                      Comment

                      • middletree

                        #12
                        Re: having an ASP variable in javascript

                        This looks like it will work; at least it did my first test.

                        thanks


                        "Vilmar Brazão de Oliveira" <suporte@hitecn et.com.br> wrote in message
                        news:e80gtrt2DH A.2548@tk2msftn gp13.phx.gbl...[color=blue]
                        > HI people,
                        > Put the asp result in a html hidden element, so afterwards attribute it to
                        > javascript variable, thus:
                        > <input type="hidden" name="hidTest" value="<%=VarAS P%>">
                        >
                        > <script>
                        > var JsTest = hidTest.value;
                        > </script>
                        >
                        > bye and good luck1
                        >
                        > --
                        >
                        > ««««««««»»»»»»» »»»»»»»
                        > Vlmar Brazão de Oliveira
                        > Desenvolvimento Web
                        > HI-TEC
                        > "Curt_C [MVP]" <software_AT_da rkfalz.com> escreveu na mensagem
                        > news:uDXQi9s2DH A.2868@TK2MSFTN GP09.phx.gbl...[color=green]
                        > > you'll have to show a few more lines of code from this asp
                        > >
                        > > --
                        > > Curt Christianson
                        > > Owner/Lead Developer, DF-Software
                        > > www.Darkfalz.com
                        > >
                        > >
                        > > "middletree " <middletree@hto mail.com> wrote in message
                        > > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
                        > > > Didn't work.
                        > > >
                        > > > The link is took me to, which should have been
                        > > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
                        > > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                        > > >
                        > > > Syntax error converting the varchar value '<=strTicketID> ' to a column[/color][/color]
                        > of[color=green][color=darkred]
                        > > > data type int.
                        > > >
                        > > > /TicketLog.asp, line 34
                        > > >
                        > > >
                        > > >
                        > > >
                        > > >
                        > > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                        > > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...
                        > > > > replace
                        > > > > addtoticket.asp ?ticketid=1000
                        > > > > with
                        > > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                        > > > >
                        > > > > --
                        > > > > Curt Christianson
                        > > > > Owner/Lead Developer, DF-Software
                        > > > > www.Darkfalz.com
                        > > > >
                        > > > >
                        > > > > "middletree " <middletree@hto mail.com> wrote in message
                        > > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                        > > > > > I have a menu that I use on my Intranet app, and while I did try[/color][/color][/color]
                        to[color=blue][color=green][color=darkred]
                        > > > > replace
                        > > > > > it recently, I ended up going back to it. It's built entirely with
                        > > > > > javascript, and works great.
                        > > > > >
                        > > > > > However, there are certain pages where I would like to be able to[/color][/color]
                        > put[color=green]
                        > > an[color=darkred]
                        > > > > > item into a querystring for a link. That is, I might have a link[/color][/color]
                        > which[color=green][color=darkred]
                        > > > is
                        > > > > > worded "Add to this ticket" and the hyperlink associated with that[/color]
                        > > text[color=darkred]
                        > > > is
                        > > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                        > > > > >
                        > > > > > I am not able to figure out how to have an ASP variable into a[/color][/color][/color]
                        link[color=blue][color=green][color=darkred]
                        > > > built
                        > > > > by
                        > > > > > javascript. This is the main question. How can I have the ASP[/color][/color]
                        > variable[color=green][color=darkred]
                        > > > in
                        > > > > a
                        > > > > > javascript?
                        > > > > >
                        > > > > > Because it's Inranet, I don't have the page to show you. However,[/color][/color][/color]
                        I[color=blue][color=green]
                        > > have[color=darkred]
                        > > > > > zipped up the two javascript files and placed them at
                        > > > > > www.middletree.net/js.zip
                        > > > > >
                        > > > > > Also, in this case, IE-specific code will not be a problem. 100%[/color][/color][/color]
                        of[color=blue][color=green][color=darkred]
                        > > > users
                        > > > > > are on IE5+
                        > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > >
                        > > >[/color]
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • Mark Schupp

                          #13
                          Re: having an ASP variable in javascript

                          It works for me all the time (not the exact same example).

                          Show exactly what you did in the .asp file and in the associated .js file.

                          --
                          Mark Schupp
                          Head of Development
                          Integrity eLearning
                          Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.



                          "middletree " <middletree@hto mail.com> wrote in message
                          news:OxEj7Vt2DH A.3416@tk2msftn gp13.phx.gbl...[color=blue]
                          > Nope. Didn't work.
                          >
                          > It gave me a link to
                          > http://localhost/TicketLog.asp?TicketID=+strTicketID
                          >
                          >
                          > "Mark Schupp" <mschupp@ielear ning.com> wrote in message
                          > news:eg2#ygs2DH A.540@tk2msftng p13.phx.gbl...[color=green]
                          > > The files where you want to substitute variables are JS files and are[/color][/color]
                          not[color=blue][color=green]
                          > > processed by ASP. There are a couple of possibilities.
                          > >
                          > > 1. make the js files .asp files and include asp code to set the
                          > > variables.
                          > >
                          > > 2. add a javacript variable declaration to the asp page before[/color]
                          > including[color=green]
                          > > the script file. then use that variable in the script file.
                          > >
                          > > ...
                          > > <script language="javas cript">
                          > > var strTicketID = "<%=YourAspVari able%>";
                          > > </script>
                          > >
                          > > <script language="javas cript" src="menu.js"></script>
                          > > ...
                          > >
                          > > in menu.js
                          > >
                          > > self.location=" addtoticket.asp ?ticketid=" + strTicketID;
                          > >
                          > > --
                          > > Mark Schupp
                          > > Head of Development
                          > > Integrity eLearning
                          > > www.ielearning.com
                          > >
                          > >
                          > > "middletree " <middletree@hto mail.com> wrote in message
                          > > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
                          > > > Didn't work.
                          > > >
                          > > > The link is took me to, which should have been
                          > > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was actually
                          > > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                          > > >
                          > > > Syntax error converting the varchar value '<=strTicketID> ' to a column[/color][/color]
                          > of[color=green][color=darkred]
                          > > > data type int.
                          > > >
                          > > > /TicketLog.asp, line 34
                          > > >
                          > > >
                          > > >
                          > > >
                          > > >
                          > > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                          > > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...
                          > > > > replace
                          > > > > addtoticket.asp ?ticketid=1000
                          > > > > with
                          > > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                          > > > >
                          > > > > --
                          > > > > Curt Christianson
                          > > > > Owner/Lead Developer, DF-Software
                          > > > > www.Darkfalz.com
                          > > > >
                          > > > >
                          > > > > "middletree " <middletree@hto mail.com> wrote in message
                          > > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                          > > > > > I have a menu that I use on my Intranet app, and while I did try[/color][/color][/color]
                          to[color=blue][color=green][color=darkred]
                          > > > > replace
                          > > > > > it recently, I ended up going back to it. It's built entirely with
                          > > > > > javascript, and works great.
                          > > > > >
                          > > > > > However, there are certain pages where I would like to be able to[/color][/color]
                          > put[color=green]
                          > > an[color=darkred]
                          > > > > > item into a querystring for a link. That is, I might have a link[/color][/color]
                          > which[color=green][color=darkred]
                          > > > is
                          > > > > > worded "Add to this ticket" and the hyperlink associated with that[/color]
                          > > text[color=darkred]
                          > > > is
                          > > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                          > > > > >
                          > > > > > I am not able to figure out how to have an ASP variable into a[/color][/color][/color]
                          link[color=blue][color=green][color=darkred]
                          > > > built
                          > > > > by
                          > > > > > javascript. This is the main question. How can I have the ASP[/color][/color]
                          > variable[color=green][color=darkred]
                          > > > in
                          > > > > a
                          > > > > > javascript?
                          > > > > >
                          > > > > > Because it's Inranet, I don't have the page to show you. However,[/color][/color][/color]
                          I[color=blue][color=green]
                          > > have[color=darkred]
                          > > > > > zipped up the two javascript files and placed them at
                          > > > > > www.middletree.net/js.zip
                          > > > > >
                          > > > > > Also, in this case, IE-specific code will not be a problem. 100%[/color][/color][/color]
                          of[color=blue][color=green][color=darkred]
                          > > > users
                          > > > > > are on IE5+
                          > > > > >
                          > > > > >
                          > > > >
                          > > > >
                          > > >
                          > > >[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • middletree

                            #14
                            Re: having an ASP variable in javascript

                            I think my problem was I had the +strTicketID inside the quotes. Pretty
                            dumb.

                            Anyway, it works now.

                            thanks

                            "Mark Schupp" <mschupp@ielear ning.com> wrote in message
                            news:#Xj6TOu2DH A.556@TK2MSFTNG P11.phx.gbl...[color=blue]
                            > It works for me all the time (not the exact same example).
                            >
                            > Show exactly what you did in the .asp file and in the associated .js file.
                            >
                            > --
                            > Mark Schupp
                            > Head of Development
                            > Integrity eLearning
                            > www.ielearning.com
                            >
                            >
                            > "middletree " <middletree@hto mail.com> wrote in message
                            > news:OxEj7Vt2DH A.3416@tk2msftn gp13.phx.gbl...[color=green]
                            > > Nope. Didn't work.
                            > >
                            > > It gave me a link to
                            > > http://localhost/TicketLog.asp?TicketID=+strTicketID
                            > >
                            > >
                            > > "Mark Schupp" <mschupp@ielear ning.com> wrote in message
                            > > news:eg2#ygs2DH A.540@tk2msftng p13.phx.gbl...[color=darkred]
                            > > > The files where you want to substitute variables are JS files and are[/color][/color]
                            > not[color=green][color=darkred]
                            > > > processed by ASP. There are a couple of possibilities.
                            > > >
                            > > > 1. make the js files .asp files and include asp code to set the
                            > > > variables.
                            > > >
                            > > > 2. add a javacript variable declaration to the asp page before[/color]
                            > > including[color=darkred]
                            > > > the script file. then use that variable in the script file.
                            > > >
                            > > > ...
                            > > > <script language="javas cript">
                            > > > var strTicketID = "<%=YourAspVari able%>";
                            > > > </script>
                            > > >
                            > > > <script language="javas cript" src="menu.js"></script>
                            > > > ...
                            > > >
                            > > > in menu.js
                            > > >
                            > > > self.location=" addtoticket.asp ?ticketid=" + strTicketID;
                            > > >
                            > > > --
                            > > > Mark Schupp
                            > > > Head of Development
                            > > > Integrity eLearning
                            > > > www.ielearning.com
                            > > >
                            > > >
                            > > > "middletree " <middletree@hto mail.com> wrote in message
                            > > > news:%23vdBJJs2 DHA.2528@TK2MSF TNGP10.phx.gbl. ..
                            > > > > Didn't work.
                            > > > >
                            > > > > The link is took me to, which should have been
                            > > > > http://localhost/TicketLog.asp?TicketID=1000&New=notnew, was[/color][/color][/color]
                            actually[color=blue][color=green][color=darkred]
                            > > > > http://localhost/TicketLog.asp?T icketID=<%=intT icketID%>&New=n otnew
                            > > > >
                            > > > > Syntax error converting the varchar value '<=strTicketID> ' to a[/color][/color][/color]
                            column[color=blue][color=green]
                            > > of[color=darkred]
                            > > > > data type int.
                            > > > >
                            > > > > /TicketLog.asp, line 34
                            > > > >
                            > > > >
                            > > > >
                            > > > >
                            > > > >
                            > > > > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                            > > > > news:uMRn2gr2DH A.2408@tk2msftn gp13.phx.gbl...
                            > > > > > replace
                            > > > > > addtoticket.asp ?ticketid=1000
                            > > > > > with
                            > > > > > addtoticket.asp ?ticketid=<%=Yo urAspVariable%>
                            > > > > >
                            > > > > > --
                            > > > > > Curt Christianson
                            > > > > > Owner/Lead Developer, DF-Software
                            > > > > > www.Darkfalz.com
                            > > > > >
                            > > > > >
                            > > > > > "middletree " <middletree@hto mail.com> wrote in message
                            > > > > > news:OZaAder2DH A.3416@tk2msftn gp13.phx.gbl...
                            > > > > > > I have a menu that I use on my Intranet app, and while I did try[/color][/color]
                            > to[color=green][color=darkred]
                            > > > > > replace
                            > > > > > > it recently, I ended up going back to it. It's built entirely[/color][/color][/color]
                            with[color=blue][color=green][color=darkred]
                            > > > > > > javascript, and works great.
                            > > > > > >
                            > > > > > > However, there are certain pages where I would like to be able[/color][/color][/color]
                            to[color=blue][color=green]
                            > > put[color=darkred]
                            > > > an
                            > > > > > > item into a querystring for a link. That is, I might have a link[/color]
                            > > which[color=darkred]
                            > > > > is
                            > > > > > > worded "Add to this ticket" and the hyperlink associated with[/color][/color][/color]
                            that[color=blue][color=green][color=darkred]
                            > > > text
                            > > > > is
                            > > > > > > along the lines of "addtoticket.as p?ticketid=1000 "
                            > > > > > >
                            > > > > > > I am not able to figure out how to have an ASP variable into a[/color][/color]
                            > link[color=green][color=darkred]
                            > > > > built
                            > > > > > by
                            > > > > > > javascript. This is the main question. How can I have the ASP[/color]
                            > > variable[color=darkred]
                            > > > > in
                            > > > > > a
                            > > > > > > javascript?
                            > > > > > >
                            > > > > > > Because it's Inranet, I don't have the page to show you.[/color][/color][/color]
                            However,[color=blue]
                            > I[color=green][color=darkred]
                            > > > have
                            > > > > > > zipped up the two javascript files and placed them at
                            > > > > > > www.middletree.net/js.zip
                            > > > > > >
                            > > > > > > Also, in this case, IE-specific code will not be a problem. 100%[/color][/color]
                            > of[color=green][color=darkred]
                            > > > > users
                            > > > > > > are on IE5+
                            > > > > > >
                            > > > > > >
                            > > > > >
                            > > > > >
                            > > > >
                            > > > >
                            > > >
                            > > >[/color]
                            > >
                            > >[/color]
                            >
                            >[/color]


                            Comment

                            Working...