SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can I submit multiple links at once??

    Is it possible to submit multiple links all at the same time using Javascript? I check all over the web and can't find any examples anywhere.

    I would like to click on a button and submit to google, yahoo, msn, etc all at the same time. Like someone physically click on http://google.com, http://yahoo.com, http://msn.com, so on.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,198
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Yes its possible, try something like this

    Code JavaScript:
    var openURL = ['google.com','yahoo.com','msn.com'];
     
    for(var i in openURL){
        if (openURL[i].substr(0,4) != 'http'){
            openURL[i] = 'http://'+openURL[i];
        }
     
        window.open(openURL[i]);
    }

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It worked, thank you
    here's the code:

    function addtext() {
    var openURL = new Array("google.com","yahoo.com","msn.com");
    for(var i=0;i<=openURL.length;i++){
    if (openURL[i].substr(0,4) != 'http'){
    openURL[i] = 'http://'+openURL[i];
    }
    window.open(openURL[i]);
    self.close();
    }
    }
    After I open the window, I would like to close it but self.close() or window.close() function does not work

    any ideas on how to close the window it opens??
    tks

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,198
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You would need something like this

    Code JavaScript:
    var openURL = ['google.com','yahoo.com','msn.com'];
     
    for(var i in openURL){
        if (openURL[i].substr(0,4) != 'http'){
            openURL[i] = 'http://'+openURL[i];
        }
     
        var window[i] = window.open(openURL[i]);
        window[i].close();
    }


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
  •