SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    script example/help

    hey guys.
    i'm new to js and in need of a quick script (i hope it's quick)
    i need to have a page with a few checkboxes that their values are img urls.
    once the user selects the desired boxes and presses submit, i would like a new window to open with the selected images loaded.
    is it possible? i have no idea how to go about it.
    cheers
    Pete

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surely having multiple windows opening would be quite annoying for the user???
    It is possible (look below) but I wouldn't recommend throwing more than one new window at the user.

    Code JavaScript:
    document.getElementById('FORM_ID').onsubmit = function() { 
        var inputs = this.getElementsByTagName('input');
        for ( var i = 0 ; i < inputs.length ; ++i ) {
            if( inputs[i].checked ) {
                window.open(inputs[i].value);
            }    
        }
        return false;
    }

    (Change 'FORM_ID' to the id of your form)
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's only one window really that includes all images.
    the reason it opens it's s easy to print in case they have other things going on the site's primary page.


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
  •