View Full Version : Javascript submit button problem

06-11-2010, 01:42 PM
I have a simple js script which toggles between 2 tabs using a simple switch function to display: block or none.

In each tab I have a form which returns data from a db using php mysql.

The problem is that when I click the submit button the page is reloaded and so the page reverts to showing the 1st tab. The data is returned correctly but the users has to click the 2nd tab to view it.

I have tried adding on onclick event to the submit button but this doesn't work. Is it possible to force the 2nd tab to show if the submit button in the 2nd tab is clicked.

Many thanks!

06-11-2010, 01:53 PM
You could call a javascript function in the onload of the page depending upon the value in GET/POST.

06-11-2010, 03:15 PM
perfect - works!

many thanks