News Bar : Ticker : GUI Components : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Event
7. Event onMethod
8. Form Control
9. GUI Components
10. HTML
11. Javascript Collections
12. Javascript Objects
13. Language Basics
14. Node Operation
15. Object Oriented
16. Page Components
17. Security
18. Style Layout
19. Table
20. Utilities
21. Window Browser
Java
Java Tutorial
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
JavaScript DHTML » GUI Components » Ticker 
News Bar

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>News Bar</title>
<style type="text/css">
.link{font-family:verdana,arial,helvetica; font-size:8pt; color:#008000; font-weight:normal}
.link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#00B400; font-weight:normal}
.header{font-family:arial,verdana,helvetica; font-size:20pt; color:#008000; font-weight:bold}
</style>
</head>
<body bgcolor="#FFFFFF">

<center>
<span class="header">News Bar</span>
<br>
<script language="javascript">
 
//**************************************************
// News Bar                                        *
// Date created : 1 March, 2002                    *
// (c) 2002 Premshree Pillai. All rights reserved. *
// http://www.qiksearch.com                        *
// [email protected]                           *
// Visit http://www.qiksearch.com/javascripts.htm  *
//                               for FREE scripts  *
// Use freely as long as this message is intact    *
//**************************************************
// Location : http://www.qiksearch.com/javascripts/news-bar.htm

var count=0;

if (navigator.appName=="Microsoft Internet Explorer" || (navigator.appName=="Netscape" && navigator.appVersion >= "5"))
{
document.write('<form name="news_bar"><input type="button" value="3" onclick="javascript:prev_news()" style="width:22; height:22; font-family:webdings; background:#FFFFFF; border-left-width:1px; border-right-width:0px; border-top-width:1px; border-bottom-width:1px; border-color:#000000; cursor:hand" name="prev" title="Previous News"><input type="button" name="news_bar_but" onclick="goURL();" style="color:#000000;background:#FFFFFF; width:350; height:22; border-width:1; border-color:#000000; cursor:hand" onmouseover="this.style.background=&#39;#E1FFE1&#39;;return true" onmouseout="this.style.background=&#39;#FFFFFF&#39;;return true" onmousedown="this.style.background=&#39;#00C000&#39;;return true"><input type="button" value="4" onclick="javascript:next_news();" style="width:22; height:22; font-family:webdings; background:#FFFFFF; border-left-width:0; border-right-width:1px; border-top-width:1px; border-bottom-width:1px; border-color:#000000; cursor:hand" name="next" title="Next News"></form>');
}
else
{
document.write('<form name="news_bar"><input type="button" value="Previous" onclick="javascript:prev_news();"><input type="button" name="news_bar_but" onclick="goURL();" width="300" border="0"><input type="button" value="Next" onclick="javascript:next_news();"></form>');
}

 var msgs = new Array(
     "Welcome to Qiksearch",
     "FREE Javascripts",
     "Intellisearch Bar NOW!",
     "www.qiksearch.com",
     "FREE Articles" )// No comma after last ticker msg

 var msg_url = new Array(
     "http://www.qiksearch.com",
     "http://www.qiksearch.com/javascripts.htm",
     "http://intellisearch.cjb.net",
     "http://www.qiksearch.com",
     "http://www.qiksearch.com/articles.htm" )// No comma after last ticker url

function init_news_bar()
{
  this.document.news_bar.news_bar_but.value=msgs[count];
}

function prev_news()

 if(count>0)
 {
  count-=1;
  this.document.news_bar.news_bar_but.value=msgs[count];
 }
 else
 {
  window.alert("This is the first News Item");
 }
}

function next_news()
{
 if(count<msgs.length-1)
 {
  count+=1;
  this.document.news_bar.news_bar_but.value=msgs[count];
 }
 else
 {
  window.alert("This is the last News Item");
 }
}

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


init_news_bar();

</script>

<table width="400" align="center" cellspacing="0" cellpadding="0"><tr><td>
<font face="verdana,arial,helvetica" size="-1" color="#000000">
This is a Cross Browser Javascript News Bar that displays a number of messages on a button.
To see the next news item, click on the right arrow (Next). To view the previous news item, click on the left arrow. (Previous)
<br><br>This news bar is very easy to customise. You can add any number of messages and their corresponding URLs. Messages must be added to the array <font face="courier">msgs</font> and the URLs must
be added to the array <font face="courier">msg_url</font>.
<br><br>This news bar displays the messages on a button. You can change the style of the button easily.
<br><br>To use this script, you just have to copy the &lt;script&gt; section of the source and paste it wherever you require on your web page.
<br><br><hr style="width:100%; height:1; color:#007000">
<a href="mailto:[email protected]?Subject=Javascripts" class="link">&#169 2002 Premshree Pillai. All rights reserved.</a>

</font>
</td></tr></table>

</center>
</body>
</html>

           
       
Related examples in the same category
1. XML Ticker (IE)
2. Text Box Ticker
3. JavaScript Ticker using Tabular Data Control
4. Fading Ticker for IE
5. JavaScript Ticker 1.3 (IE)
6. Button Ticker
Home | Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.