Results 1 to 3 of 3

Thread: Using body onload to redirect using images

  1. #1
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using body onload to redirect using images

    Hi - I am using a CMS. Through this I can post images to the index page of my site. What I want to know is it possible to add an body onload tag to an image field so that when the image displays it autoredirects to a different page.

    At the moment I've tried using this:

    Code:
    <body onload="window.location.replace('http://www.testsite.com')">
    But it redirects in my admin page rather than the main index page.

    Basically I want people when they connect to index.php to be automatically redirected to a different page, but I can't actually physically edit the source of the script, so am wondering if there is an easy way of adding this code to a field in the admin page that will load it into the index page, and I figured that doing it through an image might be the easiest thing to do.

    I want to remotely change the page, so think it's something in the 'window.location' tag that needs changing, perhaps to 'window.location.href'?

    Any suggestions appreciated.

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    <body onload="window.location.href='http://www.testsite.com'">
    - Mike

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Why Not To Use A CMS.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •