#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Question about JavaScript Function


    Hello, I am so lost with JavaScript functions. How do you include "location.href = URL in a JavaScript function?

    Thanks.
  2. #2
  3. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    706
    Rep Power
    203
    Code:
    function gotoSite(mySite){
    document.location.href = mySite;
    }
    
    gotoSite();
    This what you're looking for?

    Comments on this post

    • f_nietzsche agrees
  4. #3
  5. Autodidact
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2008
    Location
    Canada
    Posts
    741
    Rep Power
    836
    You can even drop the use of document:

    location.href = mySite;
    Soldiers, from the height of these pyramids forty centuries look down upon you.
    ▪ Napoleon, on the eve of the Battle of the Pyramids

IMN logo majestic logo threadwatch logo seochat tools logo