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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:18:36+00:00 2026-06-01T23:18:36+00:00

I’m not good at all with functions, and learning JavaScript, I need a little

  • 0

I’m not good at all with functions, and learning JavaScript, I need a little help on one of the examples I’m making to learn it. I have a question. How do I make it so that the next button is shown only when the one before it is clicked? (For example, you can’t see the Yahoo button without clicking Google first) Here’s the code:

<html>
<head>
<script type="text/javascript">
function show_prompt()
{
var name=prompt("Your Name");
if (name!=null && name!="")
  {
  alert("Thanks for clicking! You will now be redirected to Google.com");
  window.open("http://www.google.com/"};
}
</script>
<script type="text/javascript">
function show_alert()
{
alert("Thanks for clicking me! You are now going to Yahoo.com!");
window.open("http://www.yahoo.com");
}
</script>
<script type="text/javascript">
function show_alert1()
{
alert("Thanks for clicking. Have fun on facebook!");
window.open("http://www.facebook.com/");
}
</script>
</head>
<body>
<ul>
<li><input type="button" onclick="show_prompt()" value="Google" />
<li><input type="button" onclick="show_alert()" value="Yahoo" />
<li><input type="button" onclick="show_alert1()" value="Facebook" />
</ul>
</body>
</html>
  • 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-01T23:18:38+00:00Added an answer on June 1, 2026 at 11:18 pm

    Give the buttons id’s and then set their css display property as none to make them invisible (and not take up any space).

    <ul> 
      <li><input type="button" onclick="show_prompt();showNext('btnYahoo')" value="Google" /></li> 
      <li><input type="button" id="btnYahoo" onclick="show_alert();showNext('btnFacebook')" value="Yahoo" style="display:none" /></li>
      <li><input type="button" id="btnFacebook" onclick="show_alert1()" value="Facebook" style="display:none" /></li> 
    </ul>
    

    The function showNext then shows the button of the ID that is passed into the function. See above when the function is called I pass in either ‘btnYahoo’ or ‘btnFacebook’, depending on which one I want to show next.

    function showNext(showThis){
    
      document.getElementById(showThis).style.display = "block";
    
    }
    

    Hope that helps

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small

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.