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

  • SEARCH
  • Home
  • 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 7987243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:05:26+00:00 2026-06-04T12:05:26+00:00

i hava two question : 1 – for function with input value how i

  • 0

i hava two question :
1 – for function with input value how i can set interval i test this but now working

<script>
function bn(x)
{
alert (x);
}
setInterval("bn(x)",3000);
</script>
<a href="#" onclick="bn(1);">bn 1</a><br>

with setInterval("bn()",3000); work but show ‘undefine’ insteadof ‘1’

an 2- how Set repeat for two value mean when repeat this function i try for new value and function repeat for two value

<script>
function bn(x)
{
alert (x);
}
setInterval("bn(x)",3000);
</script>
<a href="#" onclick="bn(1);">bn 1</a><br>
<a href="#" onclick="bn(2);">bn 2</a>
  • 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-04T12:05:27+00:00Added an answer on June 4, 2026 at 12:05 pm

    Okay, I think I understand what you want; see below:

    For your first question, what you are currently doing will obviously not work(as you’ve likely figured out). To fix that, you must use an anonymous function; example below:

    <script>
    var x = 1;
    
    function bn(x)
    {
        alert (x);
    }
    setInterval(function() {
        bn(x);
    },3000);
    
    </script>
    
    <a href="#" onclick="x = 1;">bn 1</a><br>
    <a href="#" onclick="x = 2;">bn 2</a>
    

    As to your second question, see the last two lines above; as the function is already running all you need to control is the value of x, and make sure you set its scope as general, as opposed to specific to the function in which it is used.

    The onclick events set the value of x. I’ve made sure the code works; if the value is set to 2, then the alert will display 2, etc.

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

Sidebar

Related Questions

i hava an xml file like this: <name> <entry> <date>2012-03-18 13:53:23</date> <ID>1</ID> <category>questions</category> <question>who
I hava a function that looks something like this: require(config.php); function displayGta() { (...
I hava a simple set of two related tables of an 'order' that has
i hava a set of following tables customer(cus_id,cus_name); jointAccount(cus_id,acc_number,relationship); account(acc_number,cus_id) now i want to
I hava access DB, one of my function(C#.net) need to Exec a SQL more
i want to hava a RibbonGallery in my menue (like this ). This is
i hava two text boxs in flex.have to add two txt boxs values in
I hava two entities: PhisicalPerson (PP), JuredicalPerson (JP). And I want to create Phone
I hava a website with a navigation bar which consists of several tabs. Now
I hava a basic Hibernate/JPA question. I want to find a best practice solution

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.