Get the position of the form element on the screen by Michael Ryan

Contributed by
Rating: 1 stars1 stars1 stars1 stars1 stars / 12
November 07, 2000
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Get the position of the form element on the screen by Michael Ryan

If you know the position of the form element on the screen. You can do a window.scroll(x,y) or window.scrollTo(x,y) event..(x should probably be 0)...

This way, you can have the browser scroll to a particular pixel on the page without a redraw of the entire page.

If you are using formated tables for organization, this can be reasonably predictable. Also, in Internet Explorer only, when you can draw a form element into focus.
Form.element.focus() and will scroll to the item. If you are trying to keep an item selected when it comes up, can create a js function client side to select the items.

Here is the code..

<script>
loadSelectDefault(fe,v) {
   for (var i=0; i<fe.options.length; i++) {
     if (fe.options[i].value == v) {
       fe.options[i].selected = true;
       return;
     }
   }
   return;
}

loadFormOptions() {
var f = document.forms['myform'];
 
loadElementDefault(f.elements['myselect'],"<%=myselect_currentvalue%>");
}
</script>

<body onload="loadFormOptions()"...
blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials