Click here to Skip to main content
13,087,902 members (76,934 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi I want to implement marquee tag in my web from using jquery. in my web from i have text box ,button and div for display the requirement is i want to display the textbox text to marquee as sliding after click on button this is my code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
    <script src="" type="text/javascript"></script>
    <style type="text/css">
    .container { width: 300px;color:Green; font-family:Verdana; font-size:20px;  }
    .ticker { white-space: nowrap; }
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btn_click").click(function () {
                var textboxvalue = $("#txtbx_data").val();
                var dis = $("#div_scroll").find(".ticker").text(textboxvalue);
                $('.ticker').each(function () {
                var marq = $('<marquee></marquee>').attr({
                    'behavior': 'slide',
                    'scrollamount': 08,
                    'direction': 'left',
                    'width': '100%'

<div class="container" id="div_scroll">
<div class="ticker"></div>
    <input type="text"  id="txtbx_data" />
<input type="button" value="Click" id="btn_click" />


in above code for every texbox text one marquee is created and space of marquee is reducing
Posted 11-Oct-12 4:17am
Updated 11-Oct-12 4:19am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi Babu, check this code.
<script type="text/javascript">
        $(document).ready(function () {
            var movingDiv = $("#div_scroll").find(".ticker");
            $("#btn_click").click(function () {
                var textboxvalue = $("#txtbx_data").val();
                movingDiv.text(textboxvalue).animate({ marginLeft: '550' }, 5000, function () { $(this).animate({ marginLeft: '5' }, 5000) });
Babu Voleti 12-Oct-12 4:13am
in the above the division is moving first right then come left I want only sliding from right please i tried it it working perfect on two side how to get only from one side

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100