Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4032826
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:46:12+00:00 2026-05-20T11:46:12+00:00

Using this code v=new Date(); var bxx=document.getElementById(‘bxx’); function t(){ n=new Date(); ss={time}; s=ss-Math.round((n.getTime()-v.getTime())/1000.); m=0;h=0;

  • 0

Using this code

v=new Date();
var bxx=document.getElementById('bxx');
function t(){
    n=new Date();
    ss={time};
    s=ss-Math.round((n.getTime()-v.getTime())/1000.);
    m=0;h=0;
    if(s<0){
        bxx.innerHTML='<a ';
    }else{
        if(s>59){m=Math.floor(s/60);s=s-m*60;}
        if(m>59){h=Math.floor(m/60);m=m-h*60;}
        if(s<10){s="0"+s}
        if(m<10){m="0"+m}
        bxx.innerHTML=h+':'+m+':'+s+'<br>{name}</a>';
    }
    window.setTimeout("t();",999);
}
t();

Whenever t() is called, the page jumps to the top of the screen. Any ideas?

The {} are server parsed variables, but they should be causing any problem.

By jumping, I mean that the page, scrolled to the bottom, suddenly jumps to the top of the page

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:46:12+00:00Added an answer on May 20, 2026 at 11:46 am

    I don’t know about the jumping, but that code has a couple of issues:

    1) Hopefully all of these variables are declared somewhere that you haven’t shown? (If not, you’re falling prey to the Horror of Implicit Globals, which I’d recommend avoiding.)

    2) This code:

    bxx.innerHTML='<a ';
    

    …is asking the browser to parse an invalid HTML fragment.

    3) As is this code:

    bxx.innerHTML=h+':'+m+':'+s+'<br>{name}</a>';
    

    …as h and such are numbers, and so you end up with 1:23:45<br>name</a>.

    The innerHTML property cannot contain partial element tags, because it represents the entire content of an element, and elements can’t cross over one another like that (the DOM is a tree, not a weave).

    You’ll want to modify the code so that it’s always writing a fully-formed a tag to the bxx.innerHTML property, all in one go.

    Once you do that, it could still cause some minor jumping, if the former content of the element has different dimensions than the new content. You can mitigate that with CSS (an inline-block element with width and height, etc.).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code :- using (System.Security.Cryptography.SHA256 sha2 = new System.Security.Cryptography.SHA256Managed()) { .. }
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) {
I've got some code that looks like this: using (DBDataContext dc = new DBDataContext(ConnectionString))
In VB.NET I'm drawing an ellipse using some code like this. aPen = New
I have this code & I've tired using JQuery's appendTo() function to get this
I'm using this code, to make a request to a given URL: private static
I'm using this code, and I get the stack trace that is listed below.
I'm using this code from Microsoft to play audio notifications for my application. It's
I'm using this code to reset the identity on a table: DBCC CHECKIDENT('TableName', RESEED,
How can I change the master volume level? Using this code [DllImport (winmm.dll)] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.