Hi – I have this ticker that I have managed to get database driven – the only problem is that I would like to be able to create hyperlinks on the ticker to direct me to the news page. The ticker uses an input box that has been style’d so it doesn’t look like an input box. Whats the best way to adapt the ticker so that I can get some hyperlinks in there.
Thanks
Code:
$q = mysql_query (‘SELECT * FROM news’);
while ($row = mysql_fetch_array($q)){
$array = addslashes($row[‘intro’]);
$php_array[] = $array;
}
/
echo ‘<pre>’;
print_r ($php_array);
echo ‘<pre>’;*/
echo “<script language=’JavaScript’>n”;
echo “var line=new Array();n”;
foreach($php_array as $key => $value)
{
echo “line[$key] = “$value”;”;
}
echo ‘var longestmessage=1
for (i=2;i<line.length;i++){
if (line[i].length>line[longestmessage].length)
longestmessage=i
}
lines=line.length-1
if (document.all||document.getElementById){
document.write(“<form name=”bannerform”><input type=”text” name=”banner” size=”313″ class=”level3″ style=”border: none; height: 27px; font-size: 12px;padding-right:4px; line-height: 27px;” onfocus=”blur()” ></form>”);
}
temp=””
nextchar=-1;
nextline=0;
cursor=”*“
function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
nextline++;
nextchar=-1;
document.bannerform.banner.value=temp;
temp=””;
setTimeout(“nextstep()”,2000)}
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
nextline=1;
nextchar=-1;
document.bannerform.banner.value=temp;
temp=””;
setTimeout(“nextstep()”,2000)
} else {
nextstep()
}
}
function nextstep(){
if (cursor==”
cursor=”*“}
else if (cursor==”
cursor=”*“}
else if (cursor==”
cursor=”*“}
else if (cursor==”
cursor=”*”}
nextchar++;
temp+=line[nextline].charAt(nextchar);
document.bannerform.banner.value=temp+cursor
setTimeout(“animate()”,25)
}
if (document.all||document.getElementById)
window.onload=animate’;
echo “</script>n”;