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 8016115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:27:10+00:00 2026-06-04T20:27:10+00:00

I use jsfiddle run it and the source code is http://jsfiddle.net/eVyjC/12/ I want to

  • 0

I use jsfiddle run it and the source code is http://jsfiddle.net/eVyjC/12/

I want to add a button to start and stop number changing. I use a div containing
six spans, each has a number.

Then I use createElement to create a input button and set onclick to run the user-defined
function setInterval(keepMove) but it doesn’t work and no any error come out?

And then I test by use alert, to my surprise it run when load the page without click the
button?

My questions are:

1.Why the onclick run first when loading and how to let it run by clicking the button as I expect?

2.I try to add a br to the last span to move the button to the next line, but it doesn’t work. What’s do I wrong and how can I fix it?

Thx you for reading my problem, I have tried to figure it serveral days and try many methods but don’t work.(eg document.write html tag or createElement and Childappend )

  • 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-06-04T20:27:12+00:00Added an answer on June 4, 2026 at 8:27 pm

    1: Instead of:

    buttonNode.onclick= alert('WhyIFirstRunQQ');
    

    Do:

    buttonNode.onclick= function(){ alert('WhyIFirstRunQQ'); }
    

    That should do the trick.

    2: Use document.write("<br>");

    I strongly recommend using a javascript library such as jQuery instead of doing all this by hand.

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

Sidebar

Related Questions

This example working great because here containment is body http://jsfiddle.net/roXon/hMmbK/2/ when i use container
JSfiddle (showing the non-working code) here: http://jsfiddle.net/ts2Rr/ I have three boxes that a user
I have this Fiddle: http://jsfiddle.net/GSA5R/2/ Whereby i use the border property to create the
http://jsfiddle.net/GNK5d/ A little background information, I can not use css with this webpage due
Ooops, fiddle updated now correct In this fiddle, http://jsfiddle.net/SySRb/118/ once you click .start an
http://jsfiddle.net/r7D2x/ I'm trying to use jQuery Datepicker on a label ( <span> ) instead
I am using the below code to use xml loading in jsfiddle.net $.ajax({ type:
Hey all i have this code here on jsfiddle: http://jsfiddle.net/d7UjD/6/ I have 2 problems
http://jsfiddle.net/ksHuz/ I'm trying to use a background-image with the <a> element in this fiddle,
http://jsfiddle.net/chakri/92tqF/ I need help with the above code. I am trying to disable the

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.