Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

304
Views
When i click the button , It taking another function than the actual clicked function

when i click adult button , href should take me to link-1 and when i click adult and children button it should take me to link-2 , but which ever button i click it taking me to link-1 only , as im new to development , im unable to figure this out , can any one help me with this please , below i have added my html and script both , one more doubt is , when i give script from app.js windows.open is not working , it working only when i give from same html file , may i know why ?

<div class=" my-3">
                <a target="_blank" class="btn btn-outline-dark btn-h btn-block mx-2 btn-promo">
                  <button data-bs-toggle="modal" data-bs-target="#exampleModal" class="link-text" onclick="adult()">
                    Adult
                  </button>
                </a>
                <a target="_blank" class="btn btn-outline-dark btn-h btn-block mx-2 btn-promo">
                  <button data-bs-toggle="modal" data-bs-target="#exampleModal" class="link-text" onclick="adultChild()">
                  Adult & Child
                  </button>
                </a>
              </div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Redirecting Alert</h5>
            <button type="button" onclick="reload()" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
          </div>
          <div class="modal-body">
            Now you are redirecting to our partner site. <br><br>
            
          </div>
        </div>
      </div>
    </div>
<!-- Adult button Script -->
  <script>
    setTimeout (function adult() {
      var win = window.open();
      win.location = "www.link-1.com", "_blank";
      win.opener = null;
      win.blur();
      window.focus();
    },7000,false)
  </script>

  <!-- Adult&children button Script -->
  <script>
    setTimeout (function adultChild() {
      var win = window.open();
      win.location = "www.link-2.com", "_blank";
      win.opener = null;
      win.blur();
      window.focus();
    },7000)
  </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<div class=" my-3">
                <a target="_blank" class="btn btn-outline-dark btn-h btn-block mx-2 btn-promo">
                  <button data-bs-toggle="modal" data-bs-target="#exampleModal" class="link-text" onclick="adult()">
                    Adult
                  </button>
                </a>
                <a target="_blank" class="btn btn-outline-dark btn-h btn-block mx-2 btn-promo">
                  <button data-bs-toggle="modal" data-bs-target="#exampleModal" class="link-text" onclick="adultChild()">
                  Adult & Child
                  </button>
                </a>
              </div>

<script>
    function newadult(){
      var win = window.open();
      win.location = "www.link-1.com","_blank";
      win.opener = null;
      win.blur();
      window.focus();
    }


    function adult(){
      setTimeout(newadult,700)
    }


    function newadultChild(){
      var win = window.open();
      win.location = "www.link-2.com", "_blank";
      win.opener = null;
      win.blur();
      window.focus();
    }

    function adultChild(){
       setTimeout(newadultChild,700)
    }
      
  </script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!