I want to display a rotating banner using html and js. It works locally using a rotating function and window.onload event. For production it actually needs to run in an iframe. The iframe is on the parent page - same domain.
Below is the JS that worked which I'm adapting to make it work. It doesn't display at all.
I tried this also.
Not good with inspecting elements on the browser yet, but did notice the following error message: 'Uncaught TypeError: Cannot set property 'onload' of undefined'. This message is with regards to document.getElementsByTagName('iframe')[0].onload = rotater;
below in JS:
function rotater() {
document.getElementById("placeholderdiv").innerHTML = items[current];
current = (current === items.length - 1) ? 0 : current + 1; //increment or reset
setTimeout("rotater()", howOften);
}
document.getElementsByTagName('iframe')[0].onload = rotater;
iFrame code:
<iframe id="id_gateway_120" title="My Workspace Information Message" style="width:100%;padding:0 !important;
height:600px" marginwidth="0" marginheight="0" scrolling="auto"
src="/access/content/public/site/pages/homev1.html" width="100%" frameborder="0">