SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple JavaScript help needed

    Hi,

    When someone submits a form on my site I have a 'thankyou' page with the following piece of Javascript which automatically takes them back 2 pages after a period of 7 seconds: -

    <body onload="setTimeout('history.go(-2)',7000)">

    However, I want to change this so that it takes them straight back to my homepage. How do I alter it so it goes back to /index.php ?

    Sorry if its seems dumb but my JS is terrible.

    Many Thanks

  2. #2
    SitePoint Member doggi's Avatar
    Join Date
    Oct 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script language="javascript">
    function doIt()
    {
    location.href='index.htm';
    }

    </script>

    <body onload="setTimeout('doIt();',7000)">

  3. #3
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by doggi
    <script language="javascript">
    function doIt()
    {
    location.href='index.htm';
    }

    </script>

    <body onload="setTimeout('doIt();',7000)">
    Just in case you (the person asking the question) make sure the

    location.href='index.htm' is actually
    location.href='index.php'

    if you are trying to load the php indx file
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  4. #4
    SitePoint Member doggi's Avatar
    Join Date
    Oct 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx, I forgot to change my little test ;-)


Bookmarks

Posting Permissions

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