www.webdeveloper.com
Results 1 to 2 of 2

Thread: create a conditional back button...how?

  1. #1
    Join Date
    Aug 2009
    Posts
    1

    create a conditional back button...how?

    I am using a google form in an iframe on a web page with a typical back button such as this:
    INPUT TYPE="button" VALUE="Previous Page"
    onClick="history.go(-1);return true;"

    The problem is, if they press the back button without submitting the form, the code that works is:
    onClick="history.go(-1);return true;"
    (ie the google form)

    If they press the back button after submitting the form, the code that works is:
    onClick="history.go(-2);return true;"
    (ie the google form, the thank you page)

    But, it is 1 button. So I need an html conditional, that something like:
    If pagetitle="Google_Form.html" then
    onClick="history.go(-1);return true;"
    else
    onClick="history.go(-2);return true;"
    end if

    Can someone give me the code to do this?
    Don't assume I know much....

    Thanks
    bob

  2. #2
    Join Date
    Aug 2009
    Posts
    7
    You should probably do a javascript funtion. Have onClick="javascript:goBack(); return true;" then make the function.

    Code:
    function goBack()
    {
     // put your if statement here.
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles