Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tricky Problem with Anchors and page reloads

    Hey People:

    I have a little problem that has been driving me nutty..

    I have a form that the user enters a vaule from the dropdown menu and depending on what they select the form submits to itself and the value is queryed against a database to generate a dependant dropdown for the next field.

    this all works fine however.. seeing that the page is a little long and as the user gets to the middle part of the form when the page reloads the user is at the top of the page and he needs to scroll down to finish filling the form out..

    what I wonder if I can do is every time the page is reloaded automatically go to the beggining of the form so the user doesn't have to scroll down echtime to finish filling the form out.

    I tried setting an anchor and using window.location.has = 'NameofAnchor' but it doesn't seem to work.


    heres my Javascript functions right now.

    <script Language = "JavaScript">

    function selItem(SelMetal,SelElast,SelSealType,SelModel,SelSizeType,SelInchSize,SelMetricSize)
    { document.location.href="BuildPart.asp?SMetal="+SelMetal+"&SElast="+SelElast+"&SealType="+SelSealType +"&SModel="+SelModel+"&SizeType="+SelSizeType+"&SInch="+SelInchSize+"&SMetric="+SelMetricSize;
    }


    </script>
    This sets up the query strings to check to see if a field was filled and if it was I have some ASP code to query the database to poulate the next feild


    onChange="selItem(GetPart.BuildMetal.value,GetPart.BuildElast.value)"
    this is the event code for the first form element that calls the function.. theres other events calling the selItem function and the variables are set accordingly because I check wheather the veriable is undefiened or not.. (this tells asp that if its undefined that the user hasn't picked anything in that element yet)

    like I said all that codes ok.. I just need to have the page go to an anchor automatically everytime it reloads with the new querystring variables..

    any suggestions..
    Thank you
    Dean Forant
    Programmer

    Delta Mechanical Seals
    44 Probber Lane
    Fall River, MA 02720
    (508)324-1409

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    aName = new Array("anchor1","anchor2");
    function goAnchor(aName){
    if(document.links){
    window.location.href="#" +aName;
    }
    }


    goAnchor('anchor1');


    -james












    -james
    Last edited by jamescover; 07-09-2004 at 07:47 PM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,032
    Thanks
    0
    Thanked 248 Times in 245 Posts
    Add the anchor in the location.href part

    location.href="BuildPart.asp?SMetal="+SelMetal+"&SElast="+SelElast+"&SealType="+SelSealType+"&SModel ="+SelModel+"&SizeType="+SelSizeType+"&SInch="+SelInchSize+"&SMetric="+SelMetricSize+"#AnchorName";


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •