HTML Help
HTML Help Central . com

» Online Users: 182

0 members and 182 guests
No Members online
Most users ever online was 695, 02-16-2011 at 07:01 AM.

» Site Navigation

 > FAQ

» Domains For Sale

Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Open Random Link Generator In New Window

    Is there a way to make this random link generator script open links in a new tab or window? (tab would be preferable)

    Code:
    <script>
    <!--
    /*Super random link script- Written by JavaScript Kit
    (www.javascriptkit.com) over 200+ free JavaScripts here!
    */
    function random_all(){
    var myrandom=Math.round(Math.random()*(document.links.length-1))
    window.location=document.links[myrandom].href
    }
    //-->
    </script>
    <form>
    <input type="button" onclick="random_all()" value="Random Link!" />
    </form>
    Last edited by samliew; 11-16-2011 at 05:22 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    1,766
    Replace

    Code:
    window.location=document.links[myrandom].href
    with

    Code:
    window.open(document.links[myrandom].href);

  3. #3
    Join Date
    Nov 2011
    Posts
    2
    thank you thank you thank you!

Similar Threads

  1. Help with random link generator opening into new window or tab
    By ana in forum Javascript / AJAX / VBScript
    Replies: 1
    Last Post: 03-15-2010, 11:26 PM
  2. anchor link in sub-window to open in main window
    By marklaz in forum HTML / XHTML / XML
    Replies: 10
    Last Post: 10-28-2005, 09:31 AM
  3. Open link in new window...
    By Serene in forum HTML / XHTML / XML
    Replies: 2
    Last Post: 11-20-2004, 10:53 PM
  4. opening a open link in parent window from child window
    By marklaz in forum Javascript / AJAX / VBScript
    Replies: 1
    Last Post: 06-02-2002, 03:14 PM
  5. Random Link Pop-up Window!
    By scuzzwarez in forum HTML / XHTML / XML
    Replies: 7
    Last Post: 04-04-2002, 01:38 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1