View Full Version : Cross Browser Marquee II speeding up after async-update

10-23-2013, 03:13 PM
1) Script Title: Cross Browser Marquee II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm

3) Describe problem: I'm trying to use CMII to have an ASP:Gridview scroll automatically. This has worked quite well, as opposed to a 3rd party function I found before which couldn't deal with the next part.

The CMII script is being run inside an ASP:Updatepanel for an asynchronous postback to update the Gridview. This occurs successfully, however afterwards the scrolling appears to have gone up to the next speed. (it's a 1-10 scale, I have it set to 1, so after each update I'm thinking it adds 1 to this number)

Hopefully it's something that can be adjusted with the CMII code, because just having the scrolling animation work after a weeks worth of smashing my face into the keyboard has been quite uplifting. XD

<style type="text/css">

position: relative;
width: 200px; /*marquee width */
height: 200px; /*marquee height */
background-color: gray;
overflow: hidden;
border: 1px solid black;
padding: 2px;
padding-left: 4px;


<asp:UpdatePanel ID="UpdatePanel1" runat="server" >

<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />

<asp:Timer ID="Timer1" runat="server" Interval="20000" ontick="Timer1_Tick"></asp:Timer>

<script type="text/javascript" >
function endRequestHandler(sender, args) {
* Cross browser Marquee II- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.

var delayb4scroll = 2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed = 1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit = 1 //Pause marquee onMousever (0=no. 1=yes)?


var copyspeed = marqueespeed
var pausespeed = (pauseit == 0) ? copyspeed : 0
var actualheight = ''

function scrollmarquee() {
if (parseInt(cross_marquee.style.top) > (actualheight * (-1) + 8)) //if scroller hasn't reached the end of its height
cross_marquee.style.top = parseInt(cross_marquee.style.top) - copyspeed + "px" //move scroller upwards
else //else, reset to original position
cross_marquee.style.top = parseInt(marqueeheight) + 8 + "px"

function initializemarquee() {
cross_marquee = document.getElementById("vmarquee")
cross_marquee.style.top = 0
marqueeheight = document.getElementById("marqueecontainer").offsetHeight
actualheight = cross_marquee.offsetHeight //height of marquee content (much of which is hidden from view)
if (window.opera || navigator.userAgent.indexOf("Netscape/7") != -1) { //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height = marqueeheight + "px"
cross_marquee.style.overflow = "scroll"
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload = initializemarquee

function pageLoad() {
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack())


<div id="marqueecontainer">
<div id="vmarquee" style="position: absolute; width: 98%;">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="trc_number" DataSourceID="SqlDataSource1" >
<asp:BoundField DataField="trc_number" HeaderText="trc_number" ReadOnly="True" SortExpression="trc_number"></asp:BoundField>
<asp:BoundField DataField="trc_status" HeaderText="trc_status" SortExpression="trc_status"></asp:BoundField>