set a asp variable with a value in Javascript

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

    set a asp variable with a value in Javascript

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

    JS Code:

    <script language="JavaS cript" 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.instal led)
    {
    // 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.
  • McKirahan

    #2
    Re: set a asp variable with a value in Javascript

    "Picco" <crmpicco@aol.c om> wrote in message
    news:93a91a9.05 03090652.72f894 82@posting.goog le.com...[color=blue]
    > How can i set a asp variable with a value in Javascript?
    >
    > JS Code:
    >
    > <script language="JavaS cript" 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.instal led)
    > {
    > // 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.[/color]

    ASP executes before client-side JavaScript.

    Perhaps all you want (inside your script) is:

    document.write "Installed PDF = " & inst_pdf;


    Comment

    • crmpicco@aol.com

      #3
      Re: set a asp variable with a value in Javascript

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

      Can it not be done?

      I've tried runat=server.

      doesnt work.

      Comment

      • crmpicco@aol.com

        #4
        Re: set a asp variable with a value in Javascript

        I now have this code:

        <script language="JavaS cript" 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.instal led)
        {
        // 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.adob e.com/pub/adobe/reader/win/7x/7.0/enu/AdbeRdr70_enu_f ull.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???

        Comment

        • kaeli

          #5
          Re: set a asp variable with a value in Javascript

          In article <1110387473.490 897.36750@z14g2 000cwz.googlegr oups.com>,
          crmpicco@aol.co m enlightened us with...[color=blue]
          > 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")[/color]

          The confirm function returns boolean.

          Better:
          doInstall = confirm("Want it?");
          if (doInstall)
          {
          // do something
          }
          else
          {
          // do something else
          }
          [color=blue]
          >
          > 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.[/color]

          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.



          Comment

          • bruce_brodinsky@glic.com

            #6
            Re: set a asp variable with a value in Javascript

            move the javascript field to a hidden form field (<input type=hidden>)
            and then use Request.Form (or Request.queryst ring, whatever) to get it.

            Comment

            Working...