Vertical Text Scroller in Javascript

Well the task is to create a vertical text scroller.

It can be done using the javascript code.

Let me explain the process:

  • First of all lets make the form scrolling. So,In the html form do the following add the following attributes to the body tag onMouseover="scrollspeed=0" onMouseout="scrollspeed=current" OnLoad="NewsScrollStart();"
  • And the javascript functions used above are as follows:
    <script language="JavaScript" type="text/javascript"> 
    //<!-- HIDE CODE 
    
    var scrollspeed = "1" // SET SCROLLER SPEED 1 = SLOWEST 
    var speedjump = "30" // ADJUST SCROLL JUMPING = RANGE 20 TO 40 
    var startdelay = "2" // START SCROLLING DELAY IN SECONDS 
    var nextdelay = "0" // SECOND SCROLL DELAY IN SECONDS 0 = QUICKEST 
    var topspace = "2px" // TOP SPACING FIRST TIME SCROLLING 
    var frameheight = "200px" // IF YOU RESIZE THE WINDOW EDIT THIS HEIGHT TO MATCH 
    
    
    
    current = (scrollspeed) 
    
    
    function HeightData(){ 
    AreaHeight=dataobj.offsetHeight 
    if (AreaHeight==0){ 
    setTimeout("HeightData()",( startdelay * 1000 )) 
    } 
    else { 
    ScrollNewsDiv() 
    }} 
    
    function NewsScrollStart(){ 
    dataobj=document.all? document.all.NewsDiv : document.getElementById("NewsDiv") 
    dataobj.style.top=topspace 
    setTimeout("HeightData()",( startdelay * 1000 )) 
    } 
    
    function ScrollNewsDiv(){ 
    dataobj.style.top=parseInt(dataobj.style.top)-(scrollspeed) 
    if (parseInt(dataobj.style.top)<AreaHeight*(-1)) { 
    dataobj.style.top=frameheight 
    setTimeout("ScrollNewsDiv()",( nextdelay * 1000 )) 
    } 
    else { 
    setTimeout("ScrollNewsDiv()",speedjump) 
    }} 
    
    
    
    // END HIDE CODE --> 
    </script> 
    
    
    
    
    
  • Inside the body tag create a div element with id=”NewsDiv”
  • In the code behind add labels with text per line into this div as shown below
  • ///
    /// Handles the Load event of the Page control.
    ///
    /// The source of the event.
    /// The instance containing the event data.
    protected void Page_Load(object sender, EventArgs e)
    {
    GenerateAlert();
    }
    // Private Methods (1)

    ///
    /// this method extracts the alerts and show them in a label
    ///
    private void GenerateAlert()
    {
    XmlDocument xmldoc = new XmlDocument();
    xmldoc.Load(Server.MapPath(“../XML Files/GlobalDisasters.xml”));
    XmlNodeList xmlndlst = xmldoc.GetElementsByTagName(“title”);

    for (int i = 0; i < xmlndlst.Count; i++)
    {
    lblAlert = new Label();
    string strTitle = xmlndlst[i].InnerText.ToString();
    lblAlert.Text = strTitle + “

    “;
    NewsDiv.Controls.Add(lblAlert);
    }
    }

    kick it on DotNetKicks.com

  • IP Address validation in C#

    dotnetlogo
    In this post, I have used Regular expression to validate if the IP address provided as string is valid IP Address or not.

    Usefull when we want user to input IP address in our application and we want to check if the IP address is corrct format or not.

    public bool IsValidIP(string addr)
    {
    //create our match pattern
    string strPattern = @”^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$”;
    //create our Regular Expression object
    Regex check = new Regex(strPattern);
    //boolean variable to hold the status
    bool valid = false;
    //check to make sure an ip address was provided
    if (addr == “”)
    {
    //no address provided so return false
    valid = false;
    }
    else
    {
    //address provided so use the IsMatch Method
    //of the Regular Expression object
    valid = check.IsMatch(addr, 0);
    }
    //return the results
    return valid;
    }

    kick it on DotNetKicks.com

    Slide.Show:Open Source Slideshow control in Silverlight

    silverlightlogo
    Are you Searching for a web control for your webpage which allows you to create a cool slideshow of images??

    Slide.Show
    Vertigo Has developed an open source control in silverlight which is highly customised and can be used by publishing highly-customizable photo and video slideshows on the Web.

    Slide View
    Slide View

    Features of Slide.Show

    • Minimal setup and configuration
    • Image and video slideshows
    • Resizable for any Web page design
    • Full-screen and embedded modes
    • 100% configurable via XML, themes, or your own custom provider
    • Slideshow data from XML, Flickr, or your own custom provider
    • Auto-playback with numerous transitions (e.g. fade, shape, slide, wipe)
    • Cross-browser (e.g. IE 6/7/8, Firefox 2/3, Safari 2/3, PC and Mac)
    • Open source (e.g. extensible, configuration and data provider models, templated controls, commented code)

    Download Slide.Show

    Slide.Show Live in Action

    kick it on DotNetKicks.com