I have a page with 4 tabs, with is set to open on a default tab when loaded [Tab2].
After submitting from a simple form on this page [Tab1], it goes to the updatediary.asp page, does the updates, then redirects to the original page with a "Response.Redirect".
This is normal behaviour, but the Response.Redirect opens the page on the default tab [Tab2], and I want it to open on the tab containing the form [Tab1].
Is there any way to do this?
This is the code for the tabs :
<div class="tab"> <button class="tablinks" onclick="openTab(event, 'Enter a Visit')" id="Tab1">Tab1</button> <button class="tablinks" onclick="openTab(event, 'Medical Conditions')" id="Tab2">Tab2</button> <button class="tablinks" onclick="openTab(event, 'Treatment History')" id="Tab3">Tab3</button> <button class="tablinks" onclick="openTab(event, 'Current Pupils')" id="Tab4">Tab4</button> </div>
... and this is the function which controls the tabs :
<script>
function openTab(evt, TabName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(TabName).style.display = "block";
evt.currentTarget.className += " active";
}
// Get the element with id="Tab2" (default) and click on it
// MAKE IT OPEN TAB2
document.getElementById("Tab2").click();
</script>
Many thanks in advance!