fidoly
asked on
Document write to Iframe problem
I am seeing a particular problem in a script I have. The script will write to an iframe 3 different values, one at a time, a click of an arrow will write the next item or back up an item. For some reason the browser does not show #2. .
Here is a skimmed down version of the script:
var theHI = 0;
function forwardOne(){
theHI = theHI + 1;
window.frames.iHot.locatio n = 'about:blank';
showHotItem(theHI);
}
function backOne(){
theHI = theHI - 1;
window.frames.iHot.locatio n = 'about:blank';
showHotItem(theHI);
}
function showHotItem(HI) {
var i = frames["iHot"];
i.document.write('<html><b ody>');
if(HI == 1){i.document.write('ITEM 1')};
if(HI == 2){i.document.write('ITEM 2')};
if(HI == 3){i.document.write('ITEM 3')};
i.document.write('</body>< /html>');
}
The HTML:
<iframe name="iHot" id="iHot" src=""></iframe>
<img src=right-arrow.gif onClick=forwardOne();>
<img src=left-arrow.gif onClick=backOne();>
Do you see what could be wrong? Or could I approach this in a different way?
Many thanks,
FR.
Here is a skimmed down version of the script:
var theHI = 0;
function forwardOne(){
theHI = theHI + 1;
window.frames.iHot.locatio
showHotItem(theHI);
}
function backOne(){
theHI = theHI - 1;
window.frames.iHot.locatio
showHotItem(theHI);
}
function showHotItem(HI) {
var i = frames["iHot"];
i.document.write('<html><b
if(HI == 1){i.document.write('ITEM 1')};
if(HI == 2){i.document.write('ITEM 2')};
if(HI == 3){i.document.write('ITEM 3')};
i.document.write('</body><
}
The HTML:
<iframe name="iHot" id="iHot" src=""></iframe>
<img src=right-arrow.gif onClick=forwardOne();>
<img src=left-arrow.gif onClick=backOne();>
Do you see what could be wrong? Or could I approach this in a different way?
Many thanks,
FR.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER