F
Frances
web.dev said:Frances wrote:
Hiding the other frames with css is not a good solution. Consider
this, what if the user continuously selects a different product? Then
the page will continue to append a new child.
What you'll have to do is use the replaceChild method.
document.getElementById("id").appendChild(newChild, oldChild);
thank you very much for yr help.... so in order for this to work I have
to put a blank iframe there initially so I can replace it afterwards..
this is how I figured, but unfortunately having some problems...
var selItem;
var ifrCurr;
var div = document.getElementById("divPricing");
// this var not being read inside functions..
// (even if I take out 'var' from declaration..)
function currIF() { // to put a blank iframe..
ifrCurr = document.createElement("iframe");
ifrCurr.src = 'iframes/blank.html';
//div.appendChild(ifrCurr); // ****** var not being read...
document.getElementById("divPricing").appendChild(ifrCurr);
// errror on this line
// is null or not an obj... (??)
// no problem w/this line in below function..
}
window.onload=currIF();
function pricing() {
selItem = document.getElementById("product").value;
var ifr = document.createElement("iframe");
ifr.src = 'iframes/' + selItem + '.html';
ifr.scrolling = 'no';
ifr.style.borderWidth='0';
ifr.setAttribute(selItem, name);
document.getElementById("divPricing").appendChild(ifr);
// div.appendChild(ifr); // ******* var not being read...
// document.getElementById("divPricing").replaceChild(ifr,ifrCurr);
// can't use this line yet b/c problems w/function above....
}
thank you very much........ Frances