having an ASP variable in javascript

Discussion in 'ASP General' started by middletree, Jan 14, 2004.

  1. middletree

    middletree Guest

    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.asp?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
    www.middletree.net/js.zip

    Also, in this case, IE-specific code will not be a problem. 100% of users
    are on IE5+
    middletree, Jan 14, 2004
    #1
    1. Advertising

  2. middletree

    TomB Guest

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

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


    "middletree" <> wrote in message
    news:...
    > 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.asp?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
    > www.middletree.net/js.zip
    >
    > Also, in this case, IE-specific code will not be a problem. 100% of users
    > are on IE5+
    >
    >
    TomB, Jan 14, 2004
    #2
    1. Advertising

  3. middletree

    Curt_C [MVP] Guest

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

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "middletree" <> wrote in message
    news:...
    > 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.asp?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
    > www.middletree.net/js.zip
    >
    > Also, in this case, IE-specific code will not be a problem. 100% of users
    > are on IE5+
    >
    >
    Curt_C [MVP], Jan 14, 2004
    #3
  4. middletree

    middletree Guest

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


    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > replace
    > addtoticket.asp?ticketid=1000
    > with
    > addtoticket.asp?ticketid=<%=YourAspVariable%>
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > www.Darkfalz.com
    >
    >
    > "middletree" <> wrote in message
    > news:...
    > > 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.asp?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
    > > www.middletree.net/js.zip
    > >
    > > Also, in this case, IE-specific code will not be a problem. 100% of

    users
    > > are on IE5+
    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #4
  5. middletree

    middletree Guest

    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?TicketID=<%=intTicketID%>&New=notnew

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

    /TicketLog.asp, line 34





    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > replace
    > addtoticket.asp?ticketid=1000
    > with
    > addtoticket.asp?ticketid=<%=YourAspVariable%>
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > www.Darkfalz.com
    >
    >
    > "middletree" <> wrote in message
    > news:...
    > > 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.asp?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
    > > www.middletree.net/js.zip
    > >
    > > Also, in this case, IE-specific code will not be a problem. 100% of

    users
    > > are on IE5+
    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #5
  6. middletree

    Mark Schupp Guest

    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="javascript">
    var strTicketID = "<%=YourAspVariable%>";
    </script>

    <script language="javascript" src="menu.js"></script>
    ....

    in menu.js

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

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "middletree" <> wrote in message
    news:%...
    > 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?TicketID=<%=intTicketID%>&New=notnew
    >
    > Syntax error converting the varchar value '<=strTicketID>' to a column of
    > data type int.
    >
    > /TicketLog.asp, line 34
    >
    >
    >
    >
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:...
    > > replace
    > > addtoticket.asp?ticketid=1000
    > > with
    > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > >
    > > --
    > > Curt Christianson
    > > Owner/Lead Developer, DF-Software
    > > www.Darkfalz.com
    > >
    > >
    > > "middletree" <> wrote in message
    > > news:...
    > > > 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.asp?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
    > > > www.middletree.net/js.zip
    > > >
    > > > Also, in this case, IE-specific code will not be a problem. 100% of

    > users
    > > > are on IE5+
    > > >
    > > >

    > >
    > >

    >
    >
    Mark Schupp, Jan 14, 2004
    #6
  7. middletree

    Curt_C [MVP] Guest

    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" <> wrote in message
    news:%...
    > 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?TicketID=<%=intTicketID%>&New=notnew
    >
    > Syntax error converting the varchar value '<=strTicketID>' to a column of
    > data type int.
    >
    > /TicketLog.asp, line 34
    >
    >
    >
    >
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:...
    > > replace
    > > addtoticket.asp?ticketid=1000
    > > with
    > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > >
    > > --
    > > Curt Christianson
    > > Owner/Lead Developer, DF-Software
    > > www.Darkfalz.com
    > >
    > >
    > > "middletree" <> wrote in message
    > > news:...
    > > > 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.asp?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
    > > > www.middletree.net/js.zip
    > > >
    > > > Also, in this case, IE-specific code will not be a problem. 100% of

    > users
    > > > are on IE5+
    > > >
    > > >

    > >
    > >

    >
    >
    Curt_C [MVP], Jan 14, 2004
    #7
  8. middletree

    middletree Guest

    Comments below:

    "Mark Schupp" <> wrote in message
    news:eg2#...
    > The files where you want to substitute variables are JS files and are not
    > processed by ASP.


    That was my point in the OP. Guess I didn't communicate it well.

    >There are a couple of possibilities.
    >> 1. make the js files .asp files and include asp code to set the

    variables.
    >

    I have no idea how to do this, or what you mean, exactly.

    > 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="javascript">
    > var strTicketID = "<%=YourAspVariable%>";
    > </script>
    >
    > <script language="javascript" src="menu.js"></script>
    > ...
    >
    > in menu.js
    >
    > self.location="addtoticket.asp?ticketid=" + strTicketID;
    >


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

    thanks very much!
    middletree, Jan 14, 2004
    #8
  9. middletree

    middletree Guest

    Nope. Didn't work.

    It gave me a link to
    http://localhost/TicketLog.asp?TicketID= strTicketID


    "Mark Schupp" <> wrote in message
    news:eg2#...
    > 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="javascript">
    > var strTicketID = "<%=YourAspVariable%>";
    > </script>
    >
    > <script language="javascript" src="menu.js"></script>
    > ...
    >
    > in menu.js
    >
    > self.location="addtoticket.asp?ticketid=" + strTicketID;
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > www.ielearning.com
    >
    >
    > "middletree" <> wrote in message
    > news:%...
    > > 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?TicketID=<%=intTicketID%>&New=notnew
    > >
    > > Syntax error converting the varchar value '<=strTicketID>' to a column

    of
    > > data type int.
    > >
    > > /TicketLog.asp, line 34
    > >
    > >
    > >
    > >
    > >
    > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > news:...
    > > > replace
    > > > addtoticket.asp?ticketid=1000
    > > > with
    > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > >
    > > > --
    > > > Curt Christianson
    > > > Owner/Lead Developer, DF-Software
    > > > www.Darkfalz.com
    > > >
    > > >
    > > > "middletree" <> wrote in message
    > > > news:...
    > > > > 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.asp?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
    > > > > www.middletree.net/js.zip
    > > > >
    > > > > Also, in this case, IE-specific code will not be a problem. 100% of

    > > users
    > > > > are on IE5+
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #9
  10. middletree

    middletree Guest

    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_darkfalz.com> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    > > 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?TicketID=<%=intTicketID%>&New=notnew
    > >
    > > Syntax error converting the varchar value '<=strTicketID>' to a column

    of
    > > data type int.
    > >
    > > /TicketLog.asp, line 34
    > >
    > >
    > >
    > >
    > >
    > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > news:...
    > > > replace
    > > > addtoticket.asp?ticketid=1000
    > > > with
    > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > >
    > > > --
    > > > Curt Christianson
    > > > Owner/Lead Developer, DF-Software
    > > > www.Darkfalz.com
    > > >
    > > >
    > > > "middletree" <> wrote in message
    > > > news:...
    > > > > 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.asp?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
    > > > > www.middletree.net/js.zip
    > > > >
    > > > > Also, in this case, IE-specific code will not be a problem. 100% of

    > > users
    > > > > are on IE5+
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #10
  11. 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="<%=VarASP%>">

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

    bye and good luck1

    --

    ««««««««»»»»»»»»»»»»»»
    Vlmar Brazão de Oliveira
    Desenvolvimento Web
    HI-TEC
    "Curt_C [MVP]" <software_AT_darkfalz.com> escreveu na mensagem
    news:...
    > 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" <> wrote in message
    > news:%...
    > > 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?TicketID=<%=intTicketID%>&New=notnew
    > >
    > > Syntax error converting the varchar value '<=strTicketID>' to a column

    of
    > > data type int.
    > >
    > > /TicketLog.asp, line 34
    > >
    > >
    > >
    > >
    > >
    > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > news:...
    > > > replace
    > > > addtoticket.asp?ticketid=1000
    > > > with
    > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > >
    > > > --
    > > > Curt Christianson
    > > > Owner/Lead Developer, DF-Software
    > > > www.Darkfalz.com
    > > >
    > > >
    > > > "middletree" <> wrote in message
    > > > news:...
    > > > > 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.asp?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
    > > > > www.middletree.net/js.zip
    > > > >
    > > > > Also, in this case, IE-specific code will not be a problem. 100% of

    > > users
    > > > > are on IE5+
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Vilmar Brazão de Oliveira, Jan 14, 2004
    #11
  12. middletree

    middletree Guest

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

    thanks


    "Vilmar Brazão de Oliveira" <> wrote in message
    news:...
    > 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="<%=VarASP%>">
    >
    > <script>
    > var JsTest = hidTest.value;
    > </script>
    >
    > bye and good luck1
    >
    > --
    >
    > ««««««««»»»»»»»»»»»»»»
    > Vlmar Brazão de Oliveira
    > Desenvolvimento Web
    > HI-TEC
    > "Curt_C [MVP]" <software_AT_darkfalz.com> escreveu na mensagem
    > news:...
    > > 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" <> wrote in message
    > > news:%...
    > > > 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?TicketID=<%=intTicketID%>&New=notnew
    > > >
    > > > Syntax error converting the varchar value '<=strTicketID>' to a column

    > of
    > > > data type int.
    > > >
    > > > /TicketLog.asp, line 34
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > > news:...
    > > > > replace
    > > > > addtoticket.asp?ticketid=1000
    > > > > with
    > > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > > >
    > > > > --
    > > > > Curt Christianson
    > > > > Owner/Lead Developer, DF-Software
    > > > > www.Darkfalz.com
    > > > >
    > > > >
    > > > > "middletree" <> wrote in message
    > > > > news:...
    > > > > > 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.asp?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
    > > > > > www.middletree.net/js.zip
    > > > > >
    > > > > > Also, in this case, IE-specific code will not be a problem. 100%

    of
    > > > users
    > > > > > are on IE5+
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #12
  13. middletree

    Mark Schupp Guest

    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" <> wrote in message
    news:...
    > Nope. Didn't work.
    >
    > It gave me a link to
    > http://localhost/TicketLog.asp?TicketID= strTicketID
    >
    >
    > "Mark Schupp" <> wrote in message
    > news:eg2#...
    > > 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="javascript">
    > > var strTicketID = "<%=YourAspVariable%>";
    > > </script>
    > >
    > > <script language="javascript" src="menu.js"></script>
    > > ...
    > >
    > > in menu.js
    > >
    > > self.location="addtoticket.asp?ticketid=" + strTicketID;
    > >
    > > --
    > > Mark Schupp
    > > Head of Development
    > > Integrity eLearning
    > > www.ielearning.com
    > >
    > >
    > > "middletree" <> wrote in message
    > > news:%...
    > > > 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?TicketID=<%=intTicketID%>&New=notnew
    > > >
    > > > Syntax error converting the varchar value '<=strTicketID>' to a column

    > of
    > > > data type int.
    > > >
    > > > /TicketLog.asp, line 34
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > > news:...
    > > > > replace
    > > > > addtoticket.asp?ticketid=1000
    > > > > with
    > > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > > >
    > > > > --
    > > > > Curt Christianson
    > > > > Owner/Lead Developer, DF-Software
    > > > > www.Darkfalz.com
    > > > >
    > > > >
    > > > > "middletree" <> wrote in message
    > > > > news:...
    > > > > > 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.asp?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
    > > > > > www.middletree.net/js.zip
    > > > > >
    > > > > > Also, in this case, IE-specific code will not be a problem. 100%

    of
    > > > users
    > > > > > are on IE5+
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Mark Schupp, Jan 14, 2004
    #13
  14. middletree

    middletree Guest

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

    Anyway, it works now.

    thanks

    "Mark Schupp" <> wrote in message
    news:#...
    > 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" <> wrote in message
    > news:...
    > > Nope. Didn't work.
    > >
    > > It gave me a link to
    > > http://localhost/TicketLog.asp?TicketID= strTicketID
    > >
    > >
    > > "Mark Schupp" <> wrote in message
    > > news:eg2#...
    > > > 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="javascript">
    > > > var strTicketID = "<%=YourAspVariable%>";
    > > > </script>
    > > >
    > > > <script language="javascript" src="menu.js"></script>
    > > > ...
    > > >
    > > > in menu.js
    > > >
    > > > self.location="addtoticket.asp?ticketid=" + strTicketID;
    > > >
    > > > --
    > > > Mark Schupp
    > > > Head of Development
    > > > Integrity eLearning
    > > > www.ielearning.com
    > > >
    > > >
    > > > "middletree" <> wrote in message
    > > > news:%...
    > > > > 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?TicketID=<%=intTicketID%>&New=notnew
    > > > >
    > > > > Syntax error converting the varchar value '<=strTicketID>' to a

    column
    > > of
    > > > > data type int.
    > > > >
    > > > > /TicketLog.asp, line 34
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > > > news:...
    > > > > > replace
    > > > > > addtoticket.asp?ticketid=1000
    > > > > > with
    > > > > > addtoticket.asp?ticketid=<%=YourAspVariable%>
    > > > > >
    > > > > > --
    > > > > > Curt Christianson
    > > > > > Owner/Lead Developer, DF-Software
    > > > > > www.Darkfalz.com
    > > > > >
    > > > > >
    > > > > > "middletree" <> wrote in message
    > > > > > news:...
    > > > > > > 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.asp?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
    > > > > > > www.middletree.net/js.zip
    > > > > > >
    > > > > > > Also, in this case, IE-specific code will not be a problem. 100%

    > of
    > > > > users
    > > > > > > are on IE5+
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    middletree, Jan 14, 2004
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shil
    Replies:
    2
    Views:
    2,023
    Eliyahu Goldin
    Jan 2, 2007
  2. Jonas Daunoravicius
    Replies:
    5
    Views:
    306
    Peter
    Jul 17, 2003
  3. Steve Cosh
    Replies:
    1
    Views:
    162
    joewiii
    Nov 18, 2005
  4. Jonas Daunoravicius
    Replies:
    5
    Views:
    280
    Peter
    Jul 17, 2003
  5. tnhoe
    Replies:
    4
    Views:
    691
Loading...

Share This Page