Skip to main content

Thread: Javascript Help Needed for Scrolling Iframe Web Page


probably going wrong way here goes:

looking set old pc serve variety of static web pages on big tv @ work, act news reader staff. pc standalone (not on network or connected internet (so please note websites in array ease of testing only), , use ad-hoc wireless network upload new files , administer.

using javascript load list of web pages iframe , piece of javascript scroll div on page. nearly works , need expert point me in right direction.

entire web page:
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>changing pages... please wait</title>

<link type="text/css" rel="stylesheet" href="scroll.css">

<script type="text/javascript">

//change speed=1 integer alter scroll speed. greater faster
var speed=1
//variables scroll functions
var currentpos=0,alt=1,curpos1=0,curpos2=-1

//the array web pages , viewing times
var myframes = array('http://www.google.co.uk/', 60,
'http://ubuntuforums.org/', 60,
'http://yahoo.com/', 60,
'http://ask.com/', 60);
//variables rolling web page function
var = 0, len = myframes.length;

//these 3 functions cause whole page scroll bottom, called changesrc
function scroller(){
startit()
}

function scrollwindow(){
if (document.all &&
!document.getelementbyid)
temp=document.body.scrolltop
else
temp=window.pageyoffset
if (alt==0)
alt=2
else
alt=1
if (alt==1)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2){
if (document.all)
currentpos=document.body.scrolltop+speed
else
currentpos=window.pageyoffset+speed
window.scroll(0,currentpos)
}
else{
currentpos=0
window.scroll(0,currentpos)
}
}

function startit(){
setinterval("scrollwindow()",50)
}

//this function calls changing web pages , whole page scroll
function changesrc()
{

if (i >= len) {i = 0;} //start over
document.getelementbyid('my-iframe').src = myframes[i++];
settimeout('scroll(0,0)',3000);
settimeout('changesrc()', (myframes[i++]*1000));
settimeout('scroller()',5000);

}

//this calls changesrc on loading of page
window.onload = changesrc;
</script>



</head>

<body>
<div id="my-div">
<iframe src="" id="my-iframe" scrolling="no" ></iframe>
</div>
</body>

</html>
and style.css file goes (named scroll.css)
/* scroll css */

#my-div
{
width : 100%;
height : 2000px;
position : relative;
}

#my-iframe
{
position : absolute;
width : 100%;
height : 2000px;
border : 0;
}
both bits of scripting work, web sites don't seem load per timings set , scrolling jerky , doesn't happen when expected (and more expected)...

logic tells me:

a) load html page

b) load iframe
c) wait , start scrolling html page
d) stop scrolling @ bottom of html page
e) next iframe page called
f) scroll top of html page

g) repeat b) adinfinitum

think need couple of steps in changesrc between e), f) , b) ??


1. grateful if have , advise on scripting?

2. there / better way achieve this?

3. how use text file create array of website addresses (so have modify text file , not web page?



Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Javascript Help Needed for Scrolling Iframe Web Page


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support