.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

ScrollText in StatusBar

Posted By:satyapriyanayak       Posted Date: June 01, 2014    Points: 40    Category: Visual Studio    URL: http://www.dotnetspark.com  

In this Code Snippets we will know how to scroll text in StatusBar.
 

Method-1

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Javascript_ScrollText_in_asp.net.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script lang="javascript">
<!--
var current=0;
var x = 0;
var speed = 150;
var speed2 = 150;
function startarray(n)
{
this.length = n;
for(var i =1; i <=n; i++)
{
this[i]="";
}
}
dis_letters= new startarray(1);
dis_letters[0]="Website Created By Satyapriya Nayak";

function display_letters()
{
var m = dis_letters[current];
window.status = m.substring(0,x++) + "";
if (x == m.length + 1)
{
x=0;
current++;
if (current > dis_letters.length-1)
{
current=0;
}

setTimeout("display_letters()",speed2);

}
else
{
setTimeout("display_letters()",speed);
}
}
display_letters();
-->
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>


Method-2

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Javascript_ScrollText_in_asp.net._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script  type="text/javascript">
msg="This is an example of scrolling message";
spacer="............ .............";
pos=0;
function ScrollMessage()
{
window.status=msg.substring(pos,msg.length)+spacer+
msg.substring(0,pos);
pos++;
if(pos>msg.length)pos=0;
window.setTimeout("ScrollMessage()",100);
}
ScrollMessage();
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>


     

Further Readings:

    Responses

    No response found. Be the first to respond this post

    Post Comment

    You must Sign In To post reply
    Find More code samples in C#, ASP.Net, Vb.Net and more Here

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend