Solved

Focus at the end of an iframe window

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery Validate 4 36
how can i count words? 2 42
Where is java script information saved? 2 50
Select case on click 3 14
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

776 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