Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Focus at the end of an iframe window

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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

715 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