Welcome our webmaster and SEO forum
Please enjoy the forum, contribute what you can, and wind up the Moderators!
Closed Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Open different URL from 1 button

  1. #1
    ovi Guest

    Exclamation Open different URL from 1 button

    One day searching trough the internet for some information, I have found that is possible to open more URL from 1 button. this can be done using the following code:

    Code:
    <html>
    <head>
       <title></title>
    </head>
    <script language="javascript">
    function whackOpen(){
     var url    =  new Array(3);
     url[0]   = 'http://www.site1.com'
     url[1]   = 'http://www.site2.com'
     url[2]   = 'http://www.site3.com'
     
     for (var i = 0; i < url.length; i++){
        window.open(url[i],"","");
     }
     alert("I am so sorry for creaming your bandwidth")
    }
    </script>
    <body>
    <input type="button" onclick="whackOpen()" value="Open windows" />
    </body>
    </html>

  2. #2
    mcfox Guest

    Default

    A useful bit of code, Ovi, but I can only think that this code is only of use for window bombing the user like p0rn or warez sites (so I've been told - heh!)

  3. #3
    Duke Guest

    Default

    I actually don't understand this. Does it mean that the button has predefined list of links that it chooses from and then cycles through them?

  4. #4
    ovi Guest

    Default Hello

    When you press that button will open 3 different links.

    Ovi

  5. #5
    Duke Guest

    Default

    oh, duh, I guess I should have looked at the code a little, sorry.

    How is it that some sites are able to open random url's with the same link?

  6. #6
    ovi Guest

    Default Hello

    Look at the code, it's so simple...
    When you press the submit button, will open 3 sites that are indicated in the code as:
    url[0] = 'http://www.site1.com'
    url[1] = 'http://www.site2.com'
    url[2] = 'http://www.site3.com'

    Ovi

  7. #7
    crowebird is offline Senior Member crowebird is on a distinguished road
    Join Date
    Aug 2004
    Posts
    263

    Default

    in that code he used array so all the links in the array will open

    if instead you used

    <html>
    <head>
    <title></title>
    </head>
    <script language="javascript">
    function whackOpen(){
    myRandNumber = Math.floor(Math.random()*3); /3 for 3 links
    if (myRandNumber==0) {
    myUrl = 'http://www.site1.com'
    }
    if (myRandNumber==2) {
    myUrl = 'http://www.site2.com'
    }
    if (myRandNumber==3) {
    myUrl = 'http://www.site3.com'
    }

    window.open(myUrl ,"","");

    </script>
    <body>
    <input type="button" onclick="whackOpen()" value="Open windows" />
    </body>
    </html>

  8. #8
    Duke Guest

    Default

    Quote Originally Posted by crowebird
    in that code he used array so all the links in the array will open

    if instead you used

    <html>
    <head>
    <title></title>
    </head>
    <script language="javascript">
    function whackOpen(){
    myRandNumber = Math.floor(Math.random()*3); /3 for 3 links
    if (myRandNumber==0) {
    myUrl = 'http://www.site1.com'
    }
    if (myRandNumber==2) {
    myUrl = 'http://www.site2.com'
    }
    if (myRandNumber==3) {
    myUrl = 'http://www.site3.com'
    }

    window.open(myUrl ,"","");

    </script>
    <body>
    <input type="button" onclick="whackOpen()" value="Open windows" />
    </body>
    </html>
    This is what I was talking about Ovi, I understand that the code you posted opens up 3 windows, I was asking how one link can open up one page then be clicked again and open up an entirely new page with the same link. I wasn't referring to opening multiple pages at the same time.

  9. #9
    ovi Guest

    Default :)

    I understand now.

    Ovi

  10. #10
    Duke Guest

    Default

    Quote Originally Posted by ovi
    I understand now.

    Ovi
    I'm sure my stupid question 3 or 4 posts earlier didn't help much, my bad.

Closed Thread
Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Open Sources, Open Notebook: Why Oracle Should Worry
    By rakib in forum General Webmaster Talk
    Replies: 0
    Last Post: 07-21-2007, 07:03 AM
  2. They pressed the PR update button
    By Bagi Zoltán in forum Google
    Replies: 16
    Last Post: 04-28-2007, 02:50 PM
  3. UK WW Google Toolbar button
    By melkior_inactive in forum General Webmaster Talk
    Replies: 3
    Last Post: 03-21-2007, 09:41 AM
  4. Choose button GIVES php code
    By lim038 in forum iG Shop
    Replies: 0
    Last Post: 04-25-2004, 10:56 AM
  5. The button CHOOSE in admin section
    By Opan'ka in forum iG Shop
    Replies: 1
    Last Post: 04-25-2004, 10:54 AM

Bookmarks

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

Search Engine Friendly URLs by vBSEO 3.6.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124