set a asp variable with a value in Javascript

Discussion in 'Javascript' started by Picco, Mar 9, 2005.

  1. Picco

    Picco Guest

    How can i set a asp variable with a value in Javascript?

    JS Code:

    <script language="JavaScript" type="text/javascript">
    <!--

    if (acrobat.ver5)
    {
    // if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
    document.write("Acrobat V5 + is installed")
    var installed_pdf = "<%inst_pdf=yes%>"
    }
    else if (acrobat.installed)
    {
    // do older Acrobat stuff
    document.write(acrobat.version);
    }
    else
    {
    // Acrobat is NOT installed. Do something else.
    document.write("Acrobat is NOT installed.")
    }

    //-->
    </script>

    ASP Code:

    <% response.write "Installed PDF = " & inst_pdf & "<br>" %>

    This doesnt seem to work.
    Picco, Mar 9, 2005
    #1
    1. Advertising

  2. Picco

    McKirahan Guest

    "Picco" <> wrote in message
    news:...
    > How can i set a asp variable with a value in Javascript?
    >
    > JS Code:
    >
    > <script language="JavaScript" type="text/javascript">
    > <!--
    >
    > if (acrobat.ver5)
    > {
    > // if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
    > document.write("Acrobat V5 + is installed")
    > var installed_pdf = "<%inst_pdf=yes%>"
    > }
    > else if (acrobat.installed)
    > {
    > // do older Acrobat stuff
    > document.write(acrobat.version);
    > }
    > else
    > {
    > // Acrobat is NOT installed. Do something else.
    > document.write("Acrobat is NOT installed.")
    > }
    >
    > //-->
    > </script>
    >
    > ASP Code:
    >
    > <% response.write "Installed PDF = " & inst_pdf & "<br>" %>
    >
    > This doesnt seem to work.


    ASP executes before client-side JavaScript.

    Perhaps all you want (inside your script) is:

    document.write "Installed PDF = " & inst_pdf;
    McKirahan, Mar 9, 2005
    #2
    1. Advertising

  3. Picco

    Guest

    > ASP executes before client-side JavaScript.
    >
    > Perhaps all you want (inside your script) is:
    >
    > document.write "Installed PDF = " & inst_pdf;


    Can it not be done?

    I've tried runat=server.

    doesnt work.
    , Mar 9, 2005
    #3
  4. Picco

    Guest

    I now have this code:

    <script language="JavaScript" type="text/javascript">
    if (acrobat.ver5)
    {
    // if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
    //document.write("Acrobat V5 + is installed")
    }
    else if (acrobat.installed)
    {
    // do older Acrobat stuff
    //document.write(acrobat.version);
    }
    else
    {
    // Acrobat is NOT installed. Do something else.
    //document.write("Acrobat is NOT installed.")
    question = confirm("You do not have Adobe Acrobat Reader Installed on
    your system. \n\nClick OK to download this software now. Click Cancel
    to go Back")
    if (question !="0"){
    top.location =
    'http://ardownload.adobe.com/pub/adobe/reader/win/7x/7.0/enu/AdbeRdr70_enu_full.exe'
    }
    if (question =="0"){
    history.back()
    }

    }
    </script>

    However, if you click the 'OK' button then when the 'File Download'
    dialgoue Windows box appear should you click Cancel then i am just left
    with a white screen.

    what i want is if cancel is clicked then return to the previous page (
    a history.back) or something???
    , Mar 9, 2005
    #4
  5. Picco

    kaeli Guest

    In article <>,
    enlightened us with...
    > question = confirm("You do not have Adobe Acrobat Reader Installed on
    > your system. \n\nClick OK to download this software now. Click Cancel
    > to go Back")


    The confirm function returns boolean.

    Better:
    doInstall = confirm("Want it?");
    if (doInstall)
    {
    // do something
    }
    else
    {
    // do something else
    }

    >
    > However, if you click the 'OK' button then when the 'File Download'
    > dialgoue Windows box appear should you click Cancel then i am just left
    > with a white screen.


    Not much you can do about that, really, because you can't catch the click on
    Cancel there.
    In fact, you'll still have a blank screen once the user downloads the file,
    won't you?

    Why don't you simply tell the user they need to install it and provide a
    link? That's what other sites do.
    If you embed the document, you might be able to make the browser prompt for
    the plugins. That happens with Flash. I don't do acrobat, so I'm not sure if
    it's the same.

    --
    --
    ~kaeli~
    Time flies like an arrow. Fruit flies like a banana.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, Mar 9, 2005
    #5
  6. Picco

    Guest

    move the javascript field to a hidden form field (<input type=hidden>)
    and then use Request.Form (or Request.querystring, whatever) to get it.
    , Mar 11, 2005
    #6
    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,010
    Eliyahu Goldin
    Jan 2, 2007
  2. Matt
    Replies:
    2
    Views:
    831
    Anthony Judd
    Sep 25, 2004
  3. Chris Kennedy
    Replies:
    1
    Views:
    141
    Michael Winter
    Dec 13, 2003
  4. J.Cottingim

    set Bad variable type - SNMP::Util set

    J.Cottingim, Jul 3, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    99
    J.Cottingim
    Jul 3, 2007
  5. tnhoe
    Replies:
    4
    Views:
    684
Loading...

Share This Page