Results 1 to 5 of 5

Thread: Open New Window

  1. #1
    Join Date
    Apr 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Open New Window

    How would I change the below code, to load the source into a window (new window) rather than the iFrame that it is doing now.

    'website' has been defined earlier in the code as www.google.com, it currently works loading into iFrame.

    {
    document.getElementById("iframe").src = website;
    }

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    If I take this right, I see two possibilities:
    1. Open it using JS window.open()
    2. Why not just have something like:
    Code:
    <a href="http://www.google.com" target="_blank">google</a>
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    chopper (04-05-2008)

  4. #3
    Join Date
    Apr 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Ragana thanks for your reply.

    Long story short, the code is reading the http address from somewhere else so the href wont work.

    the window.open() sounds like a good idea, but going from my previous code I cannot work out what goes where and how.

    Ive posted the whole code below with comments so you can see whats going on:


    //////Website Parsing

    var the_url = Message; //prompt("What's the URL?","");

    //assign the chararter position of the symbol to 'dash'
    var dash = the_url.indexOf("-");

    //alert(dash);

    //get character position 2 characters after the dash variable
    var domain_start = dash + 2;

    ///get everything after the character poistion domain_start and set to variable website
    var website = the_url.substring(domain_start, the_url.length);


    //if dash is equal to or more than 19 charcater position
    //then put the website variable in the iframe.
    if (dash >= 19)
    {


    document.open.window.src = website;

    //alert(Message);
    }

  5. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Try changing this code:
    Code:
    document.open.window.src = website;
    to:
    Code:
    window.open(website,'','scrollbar=no,height=500,width=400');
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. The Following User Says Thank You to rangana For This Useful Post:

    chopper (04-05-2008)

  7. #5
    Join Date
    Apr 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Sir you are a genius. Thanks very much!

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
  •