views:

33

answers:

1

Hi,

I've created a shout box on my homepage, which refresh every three seconds. I've made it scroll default as bottom, so this box will scroll when the pings are very long. If someone want to see the old pings, they can scroll up. Due to the three second refresh, I can't read my old pings.

So I wish to restrict the shout box refresh. When I view the old pings, the shout box shouldn't refresh. Any ideas on how to accomplish this?

Thanks.

+1  A: 

If I understand your need, then youre talking about stopping a default behavior.

function stopEvent(e) {
    if(!e) var e = window.event;

    //e.cancelBubble is supported by IE - this will kill the bubbling process.
    e.cancelBubble = true;
    e.returnValue = false;

    //e.stopPropagation works only in Firefox.
    if (e.stopPropagation) {
        e.stopPropagation();
        e.preventDefault();
    }

}
jason
Where should i call the stopEvent function
Bharanikumar
Im not familiar with the CMS youre using, but you can put it in HTML<a href="#" onclick="stopEvent(event);">clicky</a>or you could put it in a function between two <script> tags like<script>function foo(e){stopEvent(e);[other code]}</script>
jason
am not sure..but just asking... onlick u called the stopEvent but your function name is foo ,,,i thing in the onclick we should call foo only know...
Bharanikumar