Check Value / Set HTML Anchor on Page Load
I've got an older JS page that has several buttons on it to dynamically add and remove sections to a page for editing. Each button click for this submits the form and reloads the page, to the top - well off where the section was just added or deleted. What I want to do is have the page go down to that new section once the page is loaded, which I anticipate doing with anchors. However with the page loading/refreshing every time a section is added or deleted, this makes things a little more difficult.
The JS functions I have now look something like this:
On the page load, I could check what value was submitted ('add' or 'delete' here) and then based on that, move the page down to where an anchor is set on it. Does that seem feasible?
document.forms.process.value = 'add';
document.forms.process.value = 'delete';
There are a number of functions like this scattered throughout multiple pages, so I can't redo it all, adding and removing sections dynamically, unfortunately.
Any suggestions would be greatly appreciated.