Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:17:16+00:00 2026-06-14T23:17:16+00:00

I want a random homepage (from a predefined list) to show up when I

  • 0

I want a random homepage (from a predefined list) to show up when I click a link. And really this is Two questions so question one, is it possible? If yes then how?

What if the file are in different folders?
Would the code then look like this?

var arrPages = [   'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/feyra/feyra.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/rayne/rayne.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/adrienna/adrienna.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/averya/aveyra.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/demaen/demaen.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/phoenyx/phoenyx.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/raven/raven.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/trysten/trysten.html', 'http://neo.graceland.edu/~rmthomas/gothyc%20cafe/xiandre/xiandre.html'];
    document.getElementById('13').onclick = function () {
        var randUrl = arrPages[Math.floor(Math.random() * arrPages.length)];
        // Redirect/popup/new tab
        window.open(randUrl,'test');
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:17:17+00:00Added an answer on June 14, 2026 at 11:17 pm
    // A predefined list of pages
            var arrPages =
                [
                    'http://google.com',
                    'http://yahoo.com',
                    'http://xtra.co.nz',
                    'http://asdf.com'
                ];
    
            // Get the element
            var aLink = document.getElementById('aLink');
    
            // Bind the click event of aLink
            aLink.onclick = function () {
    
                // Get an integer that'll determine the index of arrPages to access
                var randomInt = Math.floor(Math.random() * arrPages.length);
    
                // Get the element with an index of randomInt
                var randUrl = arrPages[randomInt];
    
                // Here you can do whatever you like with randUrl, in this case 
                //  we'll open a new window that'll point to randUrl
                //   e.g. http://xtra.co.nz
                window.open(randUrl, 'test');
            }
    

    For an explanation of the functions used to set randomInt
    see Explain Math.floor(Math.random())

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a random sound to play on a click on a button on
I want to generate random numbers from -n to n excluding 0. Can someone
I want to get random keys and their respective values from a Map. The
I want to generate some random IP Address. But evertime this generateIPAddress function returns
I'm really new at network-programming, so I hope this isn't a complete Newbie-question. I
I want a random frame.origin.x and frame.origin.y on each button click. The button need's
I want to set a var default as a random number between two values
Like in Title I want to get position from List<Vector2> positions = new List<Vector2>{/*here
I want a random expiration time on EACH iteration. This example will only randomize
I want to extract random rows from the app sqlite database in Android. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.