Det med "n" var mig der havde glemt et \-tegn, \n betyder ny linie i koden. Prøv og se om ikke nedenstående er bedre:
<?php
// iTicker//
// $Id: mod_iticker.php,v0.1 2004/07/23 Thomas Klaey
//
// Copyright (C) 2000-2003 Miro International Pty Ltd
// All rights reserved. Mambo Open Source is Free Software
// released under the GNU/GPL License.
//
// This source file is part of the Mambo Open Source Content
// Management System.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
//
http://www.gnu.org/copyleft/gpl.html.defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$content = "<center>
<script language=\"JavaScript1.2\">
var scrollerwidth=120;
var scrollerheight=80;
var scrollerbgcolor='transparent';
var scrollerbackground='scrollerback.gif';
var messages=new Array();";
$connection = mysql_connect("localhost","***","***");
mysql_select_db("***", $connection);
$query = mysql_query("SELECT * FROM lysavis ORDER BY id");
while($row = mysql_fetch_array($query)) {
$content .= 'messages[0]=\"' . $row['ticker1'] . '\";' . "\n";
$content .= 'messages[1]=\"' . $row['ticker2'] . '\";' . "\n";
$content .= 'messages[2]=\"' . $row['ticker3'] . '\";' . "\n";
$content .= 'messages[3]=\"' . $row['ticker4'] . '\";' . "\n";
}
//add more messages here if needed
$content .= "if (messages.length>1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout(\"move1(tlayer)\",3000)
setTimeout(\"move2(document.main.document.second)\",3000)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout(\"move1(tlayer)\",100)
}
else{
tlayer.top=scrollerheight
tlayer.document.write(messages[i])
tlayer.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout(\"move2(tlayer2)\",3000)
setTimeout(\"move1(document.main.document.first)\",3000)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout(\"move2(tlayer2)\",100)
}
else{
tlayer2.top=scrollerheight
tlayer2.document.write(messages[i])
tlayer2.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
tdiv.style.pixelTop=0
setTimeout(\"move3(tdiv)\",3000)
setTimeout(\"move4(second2)\",3000)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout(\"move3(tdiv)\",100)
}
else{
tdiv.style.pixelTop=scrollerheight
tdiv.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
tdiv2.style.pixelTop=0
setTimeout(\"move4(tdiv2)\",3000)
setTimeout(\"move3(first2)\",3000)
return
}
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout(\"move4(second2)\",100)
}
else{
tdiv2.style.pixelTop=scrollerheight
tdiv2.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=scrollerheight
second2.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=scrollerheight+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
</script>
<ilayer id=\"main\" width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; background=&{scrollerbackground}; visibility=hide>
<layer id=\"first\" left=0 top=1 width=&{scrollerwidth};>
<script language=\"JavaScript1.2\">
if (document.layers)
document.write(messages[0])
</script>
</layer>
<layer id=\"second\" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language=\"JavaScript1.2\">
if (document.layers)
document.write(messages[1])
</script>
</layer>
</ilayer>
<script language=\"JavaScript1.2\">
if (document.all){
document.writeln('<span id=\"main2\" style=\"position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')\">')
document.writeln('<div style=\"position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0\">')
document.writeln('<div id=\"first2\" style=\"position:absolute;width:'+scrollerwidth+';left:0;top:1;\">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id=\"second2\" style=\"position:absolute;width:'+scrollerwidth+';left:0;top:0;visibility:hidden\">')
document.write(messages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
</script>
</center>";
?>