Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Focus at the end of an iframe window

Posted on 2004-08-22
2
Medium Priority
?
639 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

916 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