Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2015
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript/ ASP question!

    Hello, I hope this can be solved.

    I am working on a site which deals with PDFs. My boss wants to be able to see who accesses these PDFs by asking them for their name and email in a pop up. I have most of the Javascript needed for this, but I cannot figure out how to capture the information the user sends to me. I have tried text files and emails but none of them seem to work out, probably because I am too new at this. I know I need a Javascript page and an ASP page, but no ASP I have used works out...

    So my question is, how do I capture the name and email the user sends me? What I have so far is below:
    Code:
    <head>
    
    <script type="text/javascript">
    
    function show_prompt()
    
    {
    
    var name=prompt("Please enter your name","Your Name Here");
    
    var email=prompt("Now enter your email address","Your email address here");
    
    if (name!=null && name!="")
    
      {
    
      <!--document.write("Hello " + name + "! How are you today?" + "Your email address is " + email);-->
    
      location.href = "http://www.smumn.edu/Resources/Images/12472.pdf";
    
      }
    
    }
    
    </script>
    
    </head>
    
     
    
     
    
    <body>
    
    <input type="button" onclick="show_prompt()" value="Show PDF" />
    
     
    
    </body>
    
    </html>
    Last edited by VIPStephan; 12-15-2016 at 12:16 PM. Reason: corrected code BB tags

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,784
    Thanks
    6
    Thanked 1,285 Times in 1,255 Posts
    You don’t need a “JavaScript page”. What you need is an HTML form and the ASP code will process the form input. This form can then be styled however you like, be it static in the page or as modal popup/overlay that is triggered by JS.

  3. #3
    New Coder
    Join Date
    May 2015
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, Stephan for your answer. I all understand.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •