Ændring i nyhedsscript
Hej eksperter...Jeg har et javascript jeg gerne vil have ændret så det får samme funktion - bare ikke i de layers som scriptet er født med.
Herefter vil jeg indsætte overskrifter og links fra en MySQL-database - men det klarer jeg selv senere.
Kan I hjælpe med at tynde ud og ændre i koden så den bare ikke ligger i et layer.
Her kommer lidt kode:
<SCRIPT language=JavaScript1.2>
/*
Vertical Pausing News Scroller
*/
<!--
var scrollerwidth=189
var scrollerheight=130
var pausebetweenimages=5000
var vSlideContent=new Array()
vSlideContent[0]='<a href="main.htm" target="mainFrame"><font size="1" face="Verdana"><strong>NY SERVICE PÅ ARTO...</font></strong><font size="1" face="Verdana"><br>TV DUNO er rykket på arto og vi glæder os til, at give dig mange gode programmer...</font></a>'
vSlideContent[1]='<a href="onair.htm" target="mainFrame"><font size="1" face="Verdana"><strong>TEMA-aften</font></strong><font size="1" face="Verdana"><br>Den danske landstræner i Speed-Skating, Sutton Atkins, gæster studiet... KLIK HER...</font></a>'
vSlideContent[2]='<a href="skanderborg.htm" target="mainFrame"><font size="1" face="Verdana"><strong>DUNO-Nyhederne</font></strong><font size="1" face="Verdana"><br>DUNO Nyhederne for uge 34 er på nettet nu... Se udsendelsen - klik her...</font></a>'
vSlideContent[3]='<a href="merchandise.htm" target="mainFrame"><font size="1" face="Verdana"><strong>NYT PÅ DUNO - MERCHANDISE</font></strong><font size="1" face="Verdana"><br>Download fede DUNO-wallpapers til DIN computer...</font></a>'
vSlideContent[4]='<a href="onair.htm" target="mainFrame"><font size="1" face="Verdana"><strong>ONLINE</font></strong><font size="1" face="Verdana"><br>Se stemningsrapport fra Langelands Festivalen i DUNO Nyhederne...</font></a>'
if (vSlideContent.length>1)
i=2
else
i=0
function locateObject(n, d) { //v3.0
var p,i,x;
if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all) x=d.all[n];
for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document);
return x;
}
function moveVTextFirstBlock(whichdiv)
{
if (document.all)
{
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5)
{
tdiv.style.pixelTop=0
setTimeout("moveVTextFirstBlock(tdiv)",pausebetweenimages)
setTimeout("moveVTextSecondBlock('vTextSecond')",pausebetweenimages)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1)
{
tdiv.style.pixelTop-=5
setTimeout("moveVTextFirstBlock(tdiv)",10)
}
else
{
tdiv.style.pixelTop=scrollerheight+5
//window.status=tdiv.style.pixelTop;
tdiv.innerHTML=vSlideContent[i]
if (i==vSlideContent.length-1)
i=0
else
i++
}
}
else
{
tlayer=eval(whichdiv)
if (tlayer.top>0&&tlayer.top<=5)
{
tlayer.top=0
setTimeout("moveVTextFirstBlock(tlayer)",pausebetweenimages)
setTimeout("moveVTextSecondBlock(locateObject('vTextSecond'))",pausebetweenimages)
return
}
if (tlayer.top>=tlayer.document.height*-1)
{
tlayer.top-=5
setTimeout("moveVTextFirstBlock(tlayer)",10)
}
else
{
tlayer.top=scrollerheight+5
tlayer.document.write(vSlideContent[i])
tlayer.document.close()
if (i==vSlideContent.length-1)
i=0
else
i++
}
}
}
function moveVTextSecondBlock(whichdiv)
{
if (document.all)
{
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5)
{
tdiv2.style.pixelTop=0
setTimeout("moveVTextSecondBlock(tdiv2)",pausebetweenimages)
setTimeout("moveVTextFirstBlock('vTextFirst')",pausebetweenimages)
return
}
//window.status=tdiv2.offsetHeight;
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("moveVTextSecondBlock('vTextSecond')",10)
}
else
{
tdiv2.style.pixelTop=scrollerheight+5
//window.status=tdiv2.style.pixelTop
tdiv2.innerHTML=vSlideContent[i]
if (i==vSlideContent.length-1)
i=0
else
i++
}
}
else if (document.layers)
{
tlayer2=eval(whichdiv)
if (tlayer2.top>0&&tlayer2.top<=5)
{
tlayer2.top=0
setTimeout("moveVTextSecondBlock(tlayer2)",pausebetweenimages)
setTimeout("moveVTextFirstBlock(locateObject('vTextMain').document.layers['vTextFirst'])",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1)
{
tlayer2.top-=5
setTimeout("moveVTextSecondBlock(tlayer2)",10)
}
else
{
tlayer2.top=scrollerheight+5
tlayer2.document.write(vSlideContent[i])
tlayer2.document.close()
if (i==vSlideContent.length-1)
i=0
else
i++
}
}
}
function startVTextScroll(){
if (document.all)
{
locateObject('vTextSecond').style.top=scrollerheight+5
locateObject('vTextFirst').visibility='visible';
locateObject('vTextSecond').visibility='visible';
moveVTextFirstBlock(locateObject("vTextFirst"))
}
else if (document.layers)
{
locateObject('vTextMain').visibility='show'
locateObject('vTextFirst').visibility='show'
locateObject('vTextSecond').top=scrollerheight+5
locateObject('vTextSecond').visibility='show'
moveVTextFirstBlock(locateObject('vTextMain').document.layers['vTextFirst'])
}
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
function MM_preloadimages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadimages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</SCRIPT>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY class=body2>
<BODY vLink=#000000 aLink=#000000 link=#000000
background="#999999"
onload="startVTextScroll();return document.MM_returnValue">
<DIV id=vTextMain
style="Z-INDEX: 2; LEFT: 0; VISIBILITY: visible; OVERFLOW: hidden; WIDTH: 200px; CLIP: rect(0px 362px 362px 0px); POSITION: absolute; TOP: 0; HEIGHT: 60px">
<DIV id=vTextFirst
style="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; Z-INDEX: 1; VISIBILITY: visible; PADDING-BOTTOM: 1px; OVERFLOW: hidden; WIDTH: 200px; CLIP: rect(0px 362px 362px 0px); PADDING-TOP: 1px; POSITION: absolute; TOP: 0; left: 0px; height: 60;">
<SCRIPT language=JavaScript>
document.write(vSlideContent[0])
</SCRIPT>
</DIV>
<DIV id=vTextSecond
style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; VISIBILITY: visible; PADDING-BOTTOM: 3px; OVERFLOW: hidden; WIDTH: 200px; CLIP: rect(0px 365px 365px 0px); PADDING-TOP: 2px; POSITION: absolute; TOP: 0px; left: 0px; height: 60;">
<script language=JavaScript>
document.write(vSlideContent[1])
</script>
</DIV>
</DIV>
<div align="left"></div>
</BODY></HTML>