How to refresh a page from an onchange command to go back to the position from where they were before?

I have some php drop down boxes that use a 'onchange' command from javascript. I was wondering how to make the page to refresh at the position it was at before the onchange command was called instead of refreshing to the top of the page? Any thoughts?

You might want to clarify what you are doing. What do you do with the onchange event? I read this a little different and thought you just wanted to get the "focus" back to the next field element. Is that true? If so the basic idea would be with focus() in Javascript. I need to know what the onchange event does to provide details but the focus method would be used like ...

I have two drop down php boxes with javascript. I select the value in the first and the page reloads to populate the second with options. I would like to know how to make the screen stay where the drop boxes are instead of having to scroll back down the page to view or select the other option.

Check the html source (i.e. View Source) in the browser and look for any script errors. Let me know what browser your are using if you have a question about this.

Do you have more than one form? Is there a form tag? I assume so but there wasn't one in the code above. Let me know about any errors and post the html source for that part of the page here if you can't find the issue.

Let me know if you have a question. One other way to do it (not as good) would be to use the hash (i.e. #part2 in the URL). You would use html like ...

<a name="part2"></a>

to make an anchor. The returning URL would just need to end with #part2 for the browser to go to the part of the page with that anchor. It isn't as good as focus since we are using a form and form fields.

I have a total of 4 forms , two with dependent drop downs and two with submit buttons. I really just would like the two forms with the drop boxes to load back where those forms are. Let me know what you think. Thanks

Let me see the html source for the page (when it comes back). It seems like the problem is a typo.

One other possible cause though is the html. I don't believe it will validate as it is. For example some of the form tags (including the one we need) are missing required attributes/properties. For example the form name. You should also include the id too. Both need to be unique from other name/ids on the page. You an use the same value for name and id but not 2 elements with the same id.

Invalid html will cause various problems but can also make the script have a hard time "finding" the elements. Let me see the html source for the page when it comes back, at least the body tag, and I'll know if that is the problem.

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

In this part of the code I tried to refresh where the delete button is but is says Expected Identifier when I load the page. But if I put it on a Submit button just above the this form then it works fine.

Is this still the same question? I thought you were trying to get the cursor and the browser focus to go to the second drop down after the page has reloaded. Is that correct? I don't see a select list (i.e. drop down) in the code you just posted.

What wasn't clear in my last comment? Your last two comments have completely confused this issue for me. Let me know if I misunderstood the question but you will need to provide details. It might help to reread our previous comments to see what we have said. I have done so and I don't see how your last comment relates to the others and the question.

Yes, I did want to refresh the page at the drop down boxes. I played around with it and got it to work with the body tag. But I didn't like that it placed the drop boxes to the bottom where it would just be enough to see the drop box. I used the tag for that situation:

<body onload="document.form3.vendor.focus();">

Then I tried to get it farther down so that it would give more room from the bottom to the drop boxes. Then I changed it to

<body onload="document.form3.submit.focus();">

Sorry I confused the subject. Its probably still confusing. I just wanted it to refresh where the second drop boxes would be in sight, but I didn't like the placement when I got it to work. Now I just want it to refresh down to the bottom of the page. That would be the best solution.

No problem. You aren't quite right on how you would use it but let me try to clarify it.

You use a named anchor. The tag is something like ...

<a name="thespot"></a>

That tag can go around an element or even text but doesn't need to. It is most often used just like that (i.e. empty) at the top of the section. When used the browser will try to place the tag at the top of the browser window. Of course if it is close to the bottom then this isn't possible.

You can see examples of its use in the Help section of this site. Click on one the topics and the browser will use a named anchor to scroll down and show you that part of the page. Another example of this would be to click on http:#20406921 to take you to my first comment in this question.

To use it you would change the URL you use to "refresh" the page. You just add "#thespot" (no quotes) to the end of the URL. Using the code you provided earlier I think it would be something like ...

self.location='test.php?customer=' + val + '#thespot' ;

Of course you can use whatever you want for the name. Let me know if you have a question or need more info.

The viewer will learn the basics of jQuery, including how to invoke it on a web page.
Reference your jQuery libraries: (CODE)
Include your new external js/jQuery file: (CODE)
Write your first lines of code to setup your site for jQuery.: (CODE)

The viewer will learn the basics of jQuery including how to code hide show and toggles.
Reference your jQuery libraries:
(CODE)
Include your new external js/jQuery file:
(CODE)
Write your first lines of code to setup your site for jQuery…