Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question opening in a target window in javascript

    Hey guys,

    wee problem.. in the code below i want the page dead to appear in a different window or frame type thing called virtualpet.. i know how to do it in HTML cos it would just be target="virtualpet" but i don't know how to add it into this code in javascript.. thanks for all your help guys

    function checkfordeath () {
    if ((hungerValue == 0) && (moodValue == 0) && (healthValue == 0) && (fitnessValue == 0) && (energyValue == 0)) {
    window.location.href = "yourpage.htm"
    }
    }

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Whenever you popup your window, give it a name
    <body onload="mywindow=window.open('original_page.htm')">

    Then refer to this name in your function
    mywindow.location.href = "yourpage.htm"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •