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.Redir ect".
This is normal behaviour, but the Response.Redire ct 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="openTa b(event, 'Enter a Visit')" id="Tab1">Tab1 </button> <button class="tablinks " onclick="openTa b(event, 'Medical Conditions')" id="Tab2">Tab2 </button> <button class="tablinks " onclick="openTa b(event, 'Treatment History')" id="Tab3">Tab3 </button> <button class="tablinks " onclick="openTa b(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="tabconte nt" and hide them
tabcontent = document.getEle mentsByClassNam e("tabcontent") ;
for (i = 0; i < tabcontent.leng th; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks " and remove the class "active"
tablinks = document.getEle mentsByClassNam e("tablinks") ;
for (i = 0; i < tablinks.length ; i++) {
tablinks[i].className = tablinks[i].className.repl ace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getEle mentById(TabNam e).style.displa y = "block";
evt.currentTarg et.className += " active";
}
// Get the element with id="Tab2" (default) and click on it
// MAKE IT OPEN TAB2
document.getEle mentById("Tab2" ).click();
</script>
Many thanks in advance!
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.Redir ect".
This is normal behaviour, but the Response.Redire ct 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="openTa b(event, 'Enter a Visit')" id="Tab1">Tab1 </button> <button class="tablinks " onclick="openTa b(event, 'Medical Conditions')" id="Tab2">Tab2 </button> <button class="tablinks " onclick="openTa b(event, 'Treatment History')" id="Tab3">Tab3 </button> <button class="tablinks " onclick="openTa b(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="tabconte nt" and hide them
tabcontent = document.getEle mentsByClassNam e("tabcontent") ;
for (i = 0; i < tabcontent.leng th; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks " and remove the class "active"
tablinks = document.getEle mentsByClassNam e("tablinks") ;
for (i = 0; i < tablinks.length ; i++) {
tablinks[i].className = tablinks[i].className.repl ace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getEle mentById(TabNam e).style.displa y = "block";
evt.currentTarg et.className += " active";
}
// Get the element with id="Tab2" (default) and click on it
// MAKE IT OPEN TAB2
document.getEle mentById("Tab2" ).click();
</script>
Many thanks in advance!