View Full Version : opening in a target window in javascript

01-15-2003, 05:19 PM
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 :o

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

01-15-2003, 05:35 PM
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"