street9009 Posted January 29, 2008 Share Posted January 29, 2008 Hello all, I've got a large form that uses AJAX to submit to a database. The confirmation messages display at the top of the form. How can I get the submit button to move the browser window to the top of the page? This is probably something so simple I'm just missing it. Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/ Share on other sites More sharing options...
valtido Posted January 29, 2008 Share Posted January 29, 2008 if its a <a> tag then <a href="#top" >TOP</a> on buttons like input <input type="submit" name="Submit" value="Submit" onClick="window.location = '#top'" /> just add the onClick="window.location = '#top'" Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-452526 Share on other sites More sharing options...
street9009 Posted January 29, 2008 Author Share Posted January 29, 2008 That does put #top in the URL like I would want it to, but it doesn't actually move it to the top where I have the <a name="top"></a> tag. Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-452582 Share on other sites More sharing options...
valtido Posted January 29, 2008 Share Posted January 29, 2008 change <a name="top"> to <a name="somethingelse"> because browers already have top. n it will go top... search for anchors on google. or somin like that how to work with them Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-452716 Share on other sites More sharing options...
street9009 Posted January 29, 2008 Author Share Posted January 29, 2008 Same thing with "thetop" as opposed to "top". Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-452744 Share on other sites More sharing options...
kts Posted January 30, 2008 Share Posted January 30, 2008 your trying to move the link and the page? Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-453831 Share on other sites More sharing options...
street9009 Posted January 30, 2008 Author Share Posted January 30, 2008 Actually, and I don't know why, when I deployed this to an external website and got it off of my local box (localhost) it works like a champ. Not sure why it wouldn't work when going through localhost, but it doesn't seem to like it. At any rate, it's working now and that's all I needed. Thanks to those that responded for the aid. Quote Link to comment https://forums.phpfreaks.com/topic/88380-solved-move-to-top-of-page-on-form-submit/#findComment-453967 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.