I'm trying to take values from the child pages through iframes into the parent or outside page and send it to a pop up (the JavaScript is in an external js file):
Code:
//JavaScript to be shared with program pages
var oreilly = new Array(); //to hold the answer from the user
function createOrder(){
clickable=document.forms[0].check
txt=""
for (i=0;i<clickable.length;++ i){
if (clickable[i].checked){
txt=txt + clickable[i].value + " "
}
}
document.getElementById("order").value="You ordered: " + txt
}
function openpopup(){
oreilly[0] = parent.parent.document.getElementById("gal1").value; //copies the user buyer to index.html hidden field
oreilly[1] = parent.parent.document.getElementById("gal2").value; //copies the user buyer to index.html hidden field
oreilly[2] = parent.parent.document.getElementById("gal3").value; //copies the user buyer to index.html hidden field
oreilly[3] = parent.parent.document.getElementById("gal4").value; //copies the user buyer to index.html hidden field
oreilly[4] = parent.parent.document.getElementById("gal5").value; //copies the user buyer to index.html hidden field
var newwindow1 = window.open("../orderform.html", "polar_bear", "width=350, height=320");
var tmp = newwindow1.document;
tmp.write("You Ordered: ");
function photos_bought(clickable, bought){
oreilly[0] = bought;
parent.parent.document.getElementById("gal1").value = bought; //copies the user buyer to index.html hidden field , so that the score_quiz() can retrieve it.
}
}
an example of an inside (iframe) page is:
Code:
<form name="frm" id="frm" action="../wait.html" method="post" >
<div id="set1" style="position:absolute; left:65px;top:146px;">
<span style="position:absolute; left: -63px; top:-55px;width:104px;">
<input name="check" id="check" type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 300dpi" />
300dpi $100<br />
<input name="check" id="check" type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 600dpi"/>
600dpi $175 </span>
<span style="position:absolute; left: 307px; top:150px;width:71px;">
<textarea name="order" id="order" cols="50" rows="5"></textarea><br />
<input type="button" onClick="createOrder();openpopup();" value="Send order" /><input type="reset" value="Reset" />
</span>
</div>
</form>