manipulating content in new window
Hello,
I am writing an online tutorial with a quiz at the end. For each question in the quiz(just a regular checkbox form)clicking a button opens the answer and explanation in a new window. I'm trying to then manipulate the explanation depending on which boxes the user checked, to give a context-dependent explanation.
This works up to a point except for the first time the new window is opened. Usually (but not always) the first time the answer is accessed it is inaccessible to the javascript and is not manipulated. Repeatedly clicking on the " get answer" button solves this. Does anyone have an idea how to fix this? I'm using PC IE5.5
here is the relevant code:
function get_answer(box_name) {
// open a new window
ans_win = window.open(answ_html, "answer", "width=500,height=250");
// this just gets a <p>tag containing the "basic" text
para = ans_win.document.getElementById(box_name);
//para is often null the 1st time this function is called
//why is it inaccessible?
if(String(para) == "null") {alert("para is null")}
}
MAny thanks for any replies, I've been banging my head for a day or 2 on this now.
|