TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 07:31:29 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 126
  • Total: 127
  • lurkalot

Links Ticker

Started by crip, March 13, 2006, 06:44:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

crip

This is a nice little Links Ticker, for use in a script block .. kinda neat.. you can change the way it looks , width + height..ticker speed et-ceteras.. Add as many links as wanted without taking up much space @ all ..


<style>
<!--
.scrollerstyle{
font-family:webdings;background:#dbdbdb;border:1px solid #000000;cursor:hand;
}
-->
</style>

<script language="javascript">

//News Bar script- By Premshree Pillai (premshree@hotmail.com)
//http://www.qiksearch.com/javascripts.htm
//Enhancements by Dynamic Drive
//Visit http://www.dynamicdrive.com for this script

var msgs = new Array(
     "Simple Machines",
     "Dynamic Drive",
     "The BlocZone.net",
     "JavaScript Kit",
     "Freewarejava",
     "Google Search",
     "Yahoo Search",
     "MSN Search",
     "Ask Jeeves",
     "Dogpile Search",
     "AltaVista",
     "Wired News",
     "Qiksearch" ); // No comma after last ticker msg

var msg_url = new Array(
     "http://www.simplemachines.org",
     "http://www.dynamicdrive.com",
     "http://www.tinyportal.co.uk",
     "http://www.javascriptkit.com",
     "http://freewarejava.com",
     "http://www.google.com",
     "http://www.yahoo.com",
     "http://www.msn.com",
     "http://www.askjeeves.com",
     "http://www.dogpile.com",
     "http://www.altavista.com",
     "http://www.wired.com",
     "http://www.qiksearch.com" ); // No comma after last ticker url

var barwidth='120px' //Enter main bar width in px or %
var setdelay=3000 //Enter delay between msgs, in mili-seconds
var mouseover_color='#cccccc' //Specify highlight color
var mouseout_color='#dbdbdb' //Specify default color
/////////////////////////////////////////////////////////////////////

var count=0;
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

if (ie4||ns6){
document.write('<form name="news_bar"><input type="button" value="3" onclick="moveit(0)" class="scrollerstyle" style="width:22px; height:22px; border-right-width:0px;" name="prev" title="Previous News"><input type="button" name="news_bar_but" onclick="goURL();" style="color:#000000;background:#dbdbdb; width:'+barwidth+'; height:22px; border-width:1; border-color:#000000; cursor:hand" onmouseover="this.style.background=mouseover_color" onmouseout="this.style.background=mouseout_color"><input type="button" value="4" onclick="moveit(1)" class="scrollerstyle" style="width:22px; height:22px; border-left-width:0px;" name="next" title="Next News"></form>');
}
else{
document.write('<form name="news_bar"><input type="button" value="Previous" onclick="moveit(0)">')
if (navigator.userAgent.indexOf("Opera")!=-1)
document.write('<input type="button" name="news_bar_but" onclick="goURL();" style="width:'+barwidth+'" border="0">')
else
document.write('<input type="button" name="news_bar_but" onclick="goURL();" width="'+barwidth+'" border="0">')
document.write('<input type="button" value="Next" onclick="moveit(1)"></form>')
}

function init_news_bar(){
  document.news_bar.news_bar_but.value=msgs[count];
}
//moveit function by Dynamicdrive.com
function moveit(how){
if (how==1){ //cycle foward
if (count<msgs.length-1)
count++
else
count=0
}
else{ //cycle backward
if (count==0)
count=msgs.length-1
else
count--
}
document.news_bar.news_bar_but.value=msgs[count];
}

setInterval("moveit(1)",setdelay)

function goURL(){
location.href=msg_url[count];
}

init_news_bar();
</script>



.

IchBin

It would be nice to have a Screenshot or a demo for stuff like this.

gerrymo

This looks like the right page. Demo included. Its not what I thought it was.

http://dynamicdrive.com/dynamicindex2/newsbar.htm

TwinsX2Dad

Here's your demo, pal.......

http://www.dynamicdrive.com/dynamicindex2/newsbar.htm

Oh wait - we got your screenshot too!   ;D

[attachment deleted by admin]

TwinsX2Dad

You wouldn't have snuck in under me, gerrymo, if you'd also taken the time to do the screenshot.   :knuppel2:

crip

Lol..i figured that was coming..

  • Demo

    you can see it tick..in FF /3/ previous \4\ next..IE your see:  > xxxxxxxxxxxxxxxx < .. just click it..lol.. ;D

    crip~

crip

see, i told ya i was slow...

Mitch

Hahaha nice. I thought by the description it was a scrolling one which I was looking for. :P

daftdate

Now guys play nice, I was just wondering how you would get it so that the link opens up in a seperate window so they dont navigate away from the forum.  Im not a java script person or web person im more of a vb.net, pascal, cobol type of gal so have been looking to see how to do it.  i understand the script how it calls the array and how the ticker works but not sure were to insert target="_blank" or target="new" if thats what i put in.  :)

daftdate

#9
As no one gave me any help i decided to try and mess around with it myself and here we are.  I changed the gourl function so it would call up a new browser window.  :) it might be simple stuff to you guys but i will get there in the end.  :)

<style>
<!--
.scrollerstyle{
font-family:webdings;background:#dbdbdb;border:1px solid #000000;cursor:hand;
}
-->
</style>

<script language="javascript">

//News Bar script- By Premshree Pillai (premshree@hotmail.com)
//http://www.qiksearch.com/javascripts.htm
//Enhancements by Dynamic Drive
//Visit http://www.dynamicdrive.com for this script

var msgs = new Array(
     "Simple Machines",
     "Third Wave",
     "The BlocZone.net",
     "JT3K!",
     "Mr Toms World",
     "Google Search",
     "Yahoo Search",
     "MSN Search",
     "Ask Jeeves",
     "Dogpile Search",
     "AltaVista",
     "Wired News",
     "Bottle of Beer" ); // No comma after last ticker msg

var msg_url = new Array(
     "http://www.simplemachines.org",
     "http://isa.wolvcoll.ac.uk/moodle",
     "http://www.tinyportal.co.uk",
     "http://www.jt3k.com/home",
     "http://wwwmrtomsworld.co.uk",
     "http://www.google.com",
     "http://www.yahoo.com",
     "http://www.msn.com",
     "http://www.askjeeves.com",
     "http://www.dogpile.com",
     "http://www.altavista.com",
     "http://www.wired.com",
     "http://www.bottleofbeer.co.uk" ); // No comma after last ticker url
var newwindow = ' ';
var barwidth='120px' //Enter main bar width in px or %
var setdelay=3000 //Enter delay between msgs, in mili-seconds
var mouseover_color='#cccccc' //Specify highlight color
var mouseout_color='#dbdbdb' //Specify default color
/////////////////////////////////////////////////////////////////////

var count=0;
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

if (ie4||ns6){
document.write('<form name="news_bar"><input type="button" value="3" onclick="moveit(0)" class="scrollerstyle" style="width:22px; height:22px; border-right-width:0px;" name="prev" title="Previous News"><input type="button" name="news_bar_but"onclick="goURL();" style="color:#000000;background:#dbdbdb; width:'+barwidth+'; height:22px; border-width:1; border-color:#000000; cursor:hand" onmouseover="this.style.background=mouseover_color" onmouseout="this.style.background=mouseout_color"><input type="button" value="4" onclick="moveit(1)" class="scrollerstyle" style="width:22px; height:22px; border-left-width:0px;" name="next" title="Next News"></form>');
}
else{
document.write('<form name="news_bar"><input type="button" value="Previous" onclick="moveit(0)">')
if (navigator.userAgent.indexOf("Opera")!=-1)
document.write('<input type="button" name="news_bar_but" onclick="goURL();" style="width:'+barwidth+'" border="0">')
else
document.write('<input type="button" name="news_bar_but"onclick="goURL();" width="'+barwidth+'" border="0">')
document.write('<input type="button" value="Next" onclick="moveit(1)"></form>')
}

function init_news_bar(){
  document.news_bar.news_bar_but.value=msgs[count];
}
//moveit function by Dynamicdrive.com
function moveit(how){
if (how==1){ //cycle foward
if (count<msgs.length-1)
count++
else
count=0
}
else{ //cycle backward
if (count==0)
count=msgs.length-1
else
count--
}
document.news_bar.news_bar_but.value=msgs[count];
}

setInterval("moveit(1)",setdelay)

function goURL(){
if (!newwindow.closed && newwindow.location)

{
        newwindow.location.href = msg_url[count];
}

else

{

      newwindow = window.open (msg_url[count], 'name', 'width=600,height=800,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');

    if (!newwindow.opener) newwindow.opener = self;

}

if (window.focus) {newwindow.focus()}
return false;



}

init_news_bar();
</script>