469,950 Members | 2,051 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

.scrollIntoView and .focus in Safari?

Do .scrollIntoView, .focus, and .select work in Safari, or am I just doing
something wrong.

The following code works in Firefox, Netscape, and IE on both Mac and
Windows, but fails on Safari:

tempobj = this.elements[index];
tempobj.scrollIntoView();
tempobj.focus();
tempobj.select();

Any suggestions?

Thanks in advance.

Sep 12 '05 #1
1 3897
Steve Murphy wrote:
Do .scrollIntoView, .focus, and .select work in Safari, or am I just doing
something wrong.

The following code works in Firefox, Netscape, and IE on both Mac and
Windows, but fails on Safari:

tempobj = this.elements[index];
tempobj.scrollIntoView();
tempobj.focus();
tempobj.select();

Any suggestions?


scrollIntoView is a Microsoft invention and may not be widely supported
outside IE (though Firefox 1.0.6 has it):

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/scrollintoview.asp>

Use feature detection before using it:

if ( tempobj.scrollIntoView ) tempobj.scrollIntoView();
...

Or use an HTML anchor.

--
Rob
Sep 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Roger Withnell | last post: by
4 posts views Thread by Roger Withnell | last post: by
1 post views Thread by bjarthur | last post: by
reply views Thread by Larry Brown | last post: by
1 post views Thread by Jim Satterfield | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.