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 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pop up screen when the user clicks to download

    Hello I want to add something to my web site. when the user clicks to download. i want to see a pop up screen which says your download has started.

    <script type="text/javascript">
    function show_alert()
    {
    alert("Your Download Started!");
    }
    </script>

    <input type="button" onclick="show_alert()" onclick="get value="Download" />

    I dont get where should i put the download link

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,216
    Thanks
    75
    Thanked 4,344 Times in 4,310 Posts
    Something like this, maybe?
    Code:
    <a href="/path/to/downloadfile.pdf" onclick="alert('Your download should start now'); return true;">
        Download all the good stuff
    </a>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,216
    Thanks
    75
    Thanked 4,344 Times in 4,310 Posts
    Ahhh...but wait! The user would have to click on the OK button of the alert before the download would start. Is that what you want? Or you want both to happen at same time?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no, he clicks and it ust warns that download started this logic should work let me see thank you=)

  • #5
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is no download link in here :/?

  • #6
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My dear friend I made the code like this
    <a href="files.me.com/ongun/b4sll8" onclick="show_alert();"><input name="Download" type="button" value="Download" /></a>

    It does not download anything

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Because your code is wrong. You cannot put a button inside a link and expect the button to work as a link.

    If you want it as a button:
    Code:
    <input type="button" value="Download" onclick="show_alert(); location.href='files.me.com/ongun/b4sll8';" />
    If you want it as a link:
    Code:
    <a href="files.me.com/ongun/b4sll8" onclick="show_alert();">Download</a>

  • #8
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much Glenn, but there is no download started here

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    You mean the "Your Download Started!" alert did not appear or the browser's download dialog did not appear?


  •  

    Posting Permissions

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