SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need to develop function to load 2 windows with onclick from a link in 1st window

    This is really simple but I can't seem to figure it out.

    I want to click on a defined link in the window that I am on by using the onclick trigger. I think I need a to call a function that will load window2 with html2, then load window3 with html3. by default, the html3 would become active. Is this possible and can anyone past on an example...

    As a heads-up I'm an old-schooler who is using frames while they still are allowed to develop an internal tool. Sorry...

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by atljj View Post
    This is really simple but I can't seem to figure it out.

    I want to click on a defined link in the window that I am on by using the onclick trigger. I think I need a to call a function that will load window2 with html2, then load window3 with html3. by default, the html3 would become active. Is this possible and can anyone past on an example...

    As a heads-up I'm an old-schooler who is using frames while they still are allowed to develop an internal tool. Sorry...
    Well assuming that the web browser allows windows to popup as new windows (which javascript has no control over) it could be as simple as this:

    Code javascript:
    document.querySelector('#clickme').onclick = function () {
        var window2 = window.open('http://www.google.com', 'window2'),
            window3 = window.open('http://www.microsoft.com', 'window3');
        window3.focus(); // for good measure
        return false;
    };
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •