Jump to content

Move to anchor after posting


tjohnson_nb

Recommended Posts

I have an application that creates quotations, orders etc. and as the user adds items the page reloads and can quite long. The problem is then the user has to scroll down to the last item to add another one - this gets to be quite time-consuming. Is there a way I can get it to do this automatically? I have tried putting anchors on each line item like this;

echo "<form action='display_quotation.php?item=$detail_number' method='post'>\n";
.........
echo "<a name='item_$detail_number'></a>\n";

and put the javascript ;

<script type='text/javascript'>
function goToAnchor() {
window.location.hash='#item_$item';
}
</script>
</head>

<body onload='goToAnchor();' >

 

This doesn't seem to work - I get in the URL  http://my_domain/display_quotation.php?item=3#item_3 but the page always goes to tiem no matter what item is passed via post.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.