Page redirection based on an event trigger

Discussion in 'Javascript' started by justaguy, Jul 31, 2011.

  1. justaguy

    justaguy Guest

    Hi,

    I wonder if there's a way to cause a page redirection based on an
    event of the current page.

    What I'd like to happen is:
    If the user does not click on the [Download] button I'll redirect him/
    her to a tips page, namely,
    the best-note-taking-tips-from-10-colleges.html file
    in the review directory

    My attempt is:
    include a hidden field named 'downloadChk' in the form of 'f'
    with default value of 0
    if the download button is clicked, change that field's value to 1
    (business role: in that case no need for redirection),
    then with the event of onbeforeunload at BODY element to determine the
    page redirection or not...

    Status:
    Not working. That is, when the condition is true page redirection did
    not occur.

    Here's the page,
    http://www.knowledgenotebook.com/download_dev.html

    What am I doing wrong? How to fix it?

    Many thanks.
     
    justaguy, Jul 31, 2011
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.