Quote:
Originally Posted by papi-ro
Please let me know if at least I'm in the right track.
|
Yes you are on the right track but I think you have a logic error here.
Code:
document.getElementById(frame)
should probably be
Code:
document.getElementById(frame1)
Anyway, maybe use this demo as a guide. The frame pages loop back to the start when the end of the array is reached.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title></title>
<style type="text/css"></style>
<script type="text/javascript">
var framePages = [
'page1.htm',
'page2.htm',
'page3.htm',
'page4.htm'
]
var currFrame = 0;
function swapFrameSrc(){
oIframe.src = framePages[currFrame];
currFrame = (++currFrame > framePages.length-1)? 0 : currFrame;
}
window.onload=function(){
oIframe = document.getElementById('myIframe');
document.getElementById('imgSwapFrame').onmouseover=swapFrameSrc;
swapFrameSrc();
}
</script>
</head>
<body>
<div>
<img src="pic1.jpg" alt="" id="imgSwapFrame" />
<iframe id="myIframe" src="" width="300" height="400" />
</div>
</body>
</html>