Solved

Focus at the end of an iframe window

Posted on 2004-08-22
2
627 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now