Solved

Focus at the end of an iframe window

Posted on 2004-08-22
2
632 Views
Last Modified: 2008-02-26
Hello.

I use the following code to focus an iframe when a button is pressed:

        window.frames[rte].focus();

It puts the cursor at the top of the iframe window.  I want the cursor a the very end.  How can I have it focus at the very bottom of the iframe window?

Thanks!
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 500 total points
ID: 11863670
Hi hank

You could do this by setting the onfocus event of the iframe but that would mean that every time it got the focus it would jump to the end, probably no use to you!

Instead you could try adding an extra line where you call the focus

window.frames[rte].focus();
window.frames[rte].scrollTo(0,10000000);

The only way i can think is to use a really really big number which is in pixels so that the page always scrolls to the bottom.

I created an example page which might help explain it. You will need to change the src of the iframe to a page you have there.

<html>
<head>
</head>
<body>

<iframe id="frmName" name="frmName" src="framechild.html"></iframe>

<input name="" type="button" onClick="window.frames['frmName'].focus();window.frames['frmName'].scrollTo(0,10000000)">
</body>
</html>



Cheers

Scott
0
 

Expert Comment

by:Angelblade
ID: 24595484
Thanks but i've already see this solution but this action don't change the position of the focus.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question