reload processing within the same page

Asked 1 years ago, Updated 1 years ago, 36 views

Thank you for your help.

The configuration includes tab content, and each tab contains an iframe video player.
These are controlled by js, and when you press the tab, the corresponding video player is switched to the display.
However, it will take time to read iframes at the same time, so I would like to read only the necessary iframes when I press the tab.In this case, is aax possible?

Ideally, the image of reloading the page should be replaced, but the idea is poor and I don't know how to solve it.Is there any good way?

<div class="tabbox"><p class="tabs">
  <a href="#tab_1" class="tabMenu" name="tab_1" onclick="ChangeTab(\'tab_1\'); return false;">tab1</a>
  <a href="#tab_2" class="tabMenu" name="tab_2" onclick="ChangeTab(\'tab_2\'); return false;">tab2</a>
  <a href="#tab_3" class="tabMenu" name="tab_3" onclick="ChangeTab(\'tab_3\'); return false;">tab3</a>
 <divid="tab_1" class="tab"><iframe></div>
 <divid="tab_2" class="tab"><iframe></div>
 <divid="tab_3" class="tab"><iframe></div>
</div><!--tabbox-->

// tab control
    functionChangeTab(tabName){
       // erase everything
         if( document.getElementById('tab_1')!=null){
            document.getElementById('tab_1').style.display="none";
         }
         if( document.getElementById('tab_2')!=null){
            document.getElementById('tab_2').style.display="none";
       }
         if( document.getElementById('tab_3')!=null){
            document.getElementById('tab_3').style.display="none";
       }

       // Display only designated locations
       vare= document.getElementById(tabName);
       e.style.display="block";

       // current tab control
       values = document.getElementsByClassName("tabMenu");
       for (vari=0;i<tabs.length;i++){
          tabs[i].classList.remove("active");
       }

       document.getElementsByName(tabName)[0].classList.add("active");
};

javascript php html

2022-09-30 18:32

1 Answers

If getElementById can switch the CSS of the specified tab, simply insert the iframe tag in innerHTML.

Image reloading the page

I think it's a good idea to generate as many pages as there are tabs.


2022-09-30 18:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.