473,785 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fastest finger first

I need to know how I scroll to a particular element with javascript.

<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.
I have delbt with all the other stuff I want it to do, I just need to
know how to make it scroll.

Cheers
Phil.

Apr 22 '06 #1
8 1968
[Please give a relevant description to your Q]

Phil_Harvey wrote on 22 apr 2006 in comp.lang.javas cript:
I need to know how I scroll to a particular element with javascript.
IE and possebly others have:

object.scrollIn toView( [bAlignToTop] )
<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.
Why not use:

<a name='here'></a>
&gt; <input name="tf_comman d" size="50" type="text">

script:

location.href=' #here'
I have delbt with all the other stuff I want it to do, I just need to
know how to make it scroll.


A man of limited desires?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 22 '06 #2
The older I get, the more that I code, the more I realise that things
should be small and simple. Desires, wishes, methods, questions,
answers. Ask small and ask many.

I think the location.href is a good option. I do have to make sue it
fits with the other bits and squiggles in my code.

Is window.scrollto supported in all browsers?

Thank you very much.

Apr 22 '06 #3
Phil_Harvey wrote on 22 apr 2006 in comp.lang.javas cript:
The older I get, the more that I code, the more I realise that things
should be small and simple. Desires, wishes, methods, questions,
answers. Ask small and ask many.

I think the location.href is a good option. I do have to make sue it
fits with the other bits and squiggles in my code.

Is window.scrollto supported in all browsers?


I only test IE & FF, and would like to test Safari.

scrollto() I never tested yet.

Strange, btw, scrollTo and scrollBy
are only defined for the window object,
should also be nice for scrollable divs.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 22 '06 #4
On 2006-04-22 11:23:55 +0200, "Evertjan." <ex************ **@interxnl.net > said:
<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.


Why not use:

<a name='here'></a>
&gt; <input name="tf_comman d" size="50" type="text">

script:

location.href=' #here'


a similar but slightly shorter (and simpler) way to define fragment
identifiers is to use the id attribute of any element (should work with
all browsers that support HTML 4).

so, no <a>, just change the <input> to this :

<input id="here" name="tf_comman d" size="50" type="text">

and use the same script to scroll.
--
David Junger

Apr 22 '06 #5
Touffy wrote on 22 apr 2006 in comp.lang.javas cript:
On 2006-04-22 11:23:55 +0200, "Evertjan."
<ex************ **@interxnl.net > said:
<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.


Why not use:

<a name='here'></a>
&gt; <input name="tf_comman d" size="50" type="text">

script:

location.href=' #here'


a similar but slightly shorter (and simpler) way to define fragment
identifiers is to use the id attribute of any element (should work
with all browsers that support HTML 4).

so, no <a>, just change the <input> to this :

<input id="here" name="tf_comman d" size="50" type="text">

and use the same script to scroll.


This script?:

location.href=' #here'

I don't think so!

What srpt are you referring to?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 22 '06 #6

Phil_Harvey wrote:
I need to know how I scroll to a particular element with javascript.

<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.
I have delbt with all the other stuff I want it to do, I just need to
know how to make it scroll.

Cheers
Phil.


Just a quick thought, you could use internal links in order to scroll
to the anchor. Although this wouldn't exactly "scroll", it would bring
you there. If you have any information that needs to stay in place in
a dynamic form element, please disregard this comment, as internal
links reload the page into a certain configuration, removing all
dynamic form info.

Apr 23 '06 #7
With this internal linking structure, you could just use the onChange
event in order to have the site execute a script every time the client
changes the input box. Using that, you could add a simple
modification:
<input type=text name="..." onChange()="int ernal_link_scro ll();">
...
<script type="text/javascript">
function internal_link_s croll
{
location.href = "whatever your internal link's name is, preceded by
a pound sign (#)"; //Your internal link might be something like:
#scrolleditem
}
</script>
...

I remain your most humble and Ob't Sv't in our battle against the King.

--
Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment

Apr 23 '06 #8
On 2006-04-22 19:06:12 +0200, "Evertjan." <ex************ **@interxnl.net > said:
Touffy wrote on 22 apr 2006 in comp.lang.javas cript:
On 2006-04-22 11:23:55 +0200, "Evertjan."
<ex************ **@interxnl.net > said:
<label>&gt; <input name="tf_comman d" size="50" type="text"></label>

for example I want the screen to scroll to this input box whenever
something is entered.

Why not use:

<a name='here'></a>
&gt; <input name="tf_comman d" size="50" type="text">

script:

location.href=' #here'


a similar but slightly shorter (and simpler) way to define fragment
identifiers is to use the id attribute of any element (should work
with all browsers that support HTML 4).

so, no <a>, just change the <input> to this :

<input id="here" name="tf_comman d" size="50" type="text">

and use the same script to scroll.


This script?:

location.href=' #here'

I don't think so!

What srpt are you referring to?


yes, this very script. The id attribute in any displayed element is
treated just like the name attribute in <a> tags, as far as fragment
identifiers are connerned, including the way you refer to them in a URL.

http://www.w3.org/TR/html4/struct/global.html#adef-id
--
David Junger

Apr 26 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2549
by: Simon | last post by:
Hi, If I have a string, (variable len), and I am looking for the first position of one char in array starting from position 'x' For example, // the 'haystack' $string = "PHP is great, php is ok"; // the needles
9
32656
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is the English term for this process; itemize? tokenize? digitize? sequence?) Some examples:
4
3560
by: laurenq uantrell | last post by:
I am trying to determine which of three stored procedure designs are fastest in the Query Analyzer: One query is a straight SELECT query with all desired rows and a dozen (tblName.RowName = @param or @param = Null) filters in the WHERE statement. One query populates a #Temp table with the UniqueIDs from the results of the SELECT query in the above example, then joins that #Temp table to get the desired rows.
11
3621
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
1
1243
by: Jim Hubbard | last post by:
I want to do driver development and activeX creation......what would you suggest as far as the best/fastest path to learning C++ for these tasks?
3
1792
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3 string arrays, which are just lists of people or companies in alphabetic order. These names may have accented and umlauted characters (which are present as the plain ASCII - not as the entity &# character). The page is UTF-8 encoded. e.g. ...
1
2431
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3 string arrays, which are just lists of people or companies in alphabetic order. These names may have accented and umlauted characters (which are present as the plain ASCII - not as the entity &# character). The page is UTF-8 encoded. e.g. ...
1
2670
by: Esmael | last post by:
Hi... I'ved develop a Daily Time Record System in my previous projects using bascode as input...and this was a years ago... Recently.. my projects requires a finger scanner as input is there anyone who can help me? OS- WinXP Prog.Language-VB6 Finger Scanner-Hamster II Database-MS Access2000
4
1571
by: victor robbin | last post by:
Hi... is it possible to move a picture around the form with human fingers? I have a form with one picture on it........when my finger touch one picture, I would like the picture to follow it and then place the picture there......... input = webcam Can anyone tell me how with a code example ??
9
3125
by: chandru4ni | last post by:
Hello, I know there exits Windows APIs for reading the logon credentials. We can read the logon password using the APIs. I am working on a module which requires the finger print ID associated with the finger print logon. If such an information exists please let me know. One of the interface in the module requires that input. Please do the needful.
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.