简体   繁体   English

动态更改字幕文本,而无需更改字幕位置

[英]dynamically change marquee text without changing position of marquee

I am currently working on stock based web application and i want to display price of different stocks in marquee. 我目前正在基于股票的Web应用程序上工作,我想以选取框显示不同股票的价格。 Due to frequent change of stock prices i had to update text of marquee dynamically. 由于股价经常变动,我不得不动态更新字幕的文本。 Its easy to change text, but after updation marquee starts from initial position and thats the problem. 它很容易更改文本,但是更新字幕后从初始位置开始,这就是问题所在。 Is there any way to change text without changing its current position??? 有什么方法可以更改文本而不更改其当前位置???

I'm currently using update panel and timer to change its text. 我目前正在使用更新面板和计时器来更改其文本。

    <ContentTemplate>
        <asp:Timer ID="Timer1" runat="server" Interval="1000" Enabled="True" OnTick="Timer1_Tick">
        </asp:Timer> 
        <marquee id="marque" style="width: 700px" direction="right" runat="server"></marquee>
    </ContentTemplate>

and changing text using back end .cs file marque.InnerText = dynamic_data; 并使用后端.cs文件marque.InnerText = dynamic_data;更改文本。

The problem is, that you change the text in the code-behind file. 问题是,您更改了代码隐藏文件中的文本。 That means a post-back is needed to change the text. 这意味着需要回发来更改文本。 A post-back is nothing else than a full reload of the page and for sure it resets your marquee. 回发无非就是重新加载页面的全部内容,并且可以确保重设选框。

Change the text on client side per javascript. 更改每个javascript客户端上的文本。 If you need to bring the text out of the back-end, use a page method and connect from client-side to it. 如果需要将文本带出后端,请使用页面方法,并从客户端连接到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM