?
Solved

getting focus for a frame

Posted on 2004-08-27
8
Medium Priority
?
227 Views
Last Modified: 2010-04-06
hi,

I have a html page with 3 frames. one of the frames contains an applet. when you open the page i would like the keyboard focus to be directed to the frame with the applet (so you can just start typing in a text field). how can i do that ?

thanks
0
Comment
Question by:hapciu
8 Comments
 
LVL 10

Expert Comment

by:rockmansattic
ID: 11918257
this should work

http://developer.irt.org/script/57.htm


Rockman
0
 

Author Comment

by:hapciu
ID: 11918396
there are 2 solutions there.. they don't work for me. maybe beacause of my applet ?
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11921371
You probaly hve to give the applet an id so you can reference it through the DOM with:

top.frames['framename'].document.getElementById('appletid').focus();

OR yo may have to reference a functin on th epage with the applet to set focus with:

top.frames['framename'].yourfunction();

Cd&
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:hapciu
ID: 11925484
COBOLdinosaur: I don't know javascript very well. please give me some sample code
thanks
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11926468
Post a link to the page or your code, so I have someidea of what you are doing.

Cd&
0
 

Author Comment

by:hapciu
ID: 11936969
index.html:

************************
<HTML>
<HEAD>
      <SCRIPT language='JavaScript'>
            function expand(p) {
                  parent.down.cols = p + '%, ' + (100-p) + '%';
            }
            
      </SCRIPT>
</HEAD>
<FRAMESET rows='65%, 35%'>
      <FRAMESET id='up' cols='*, 350' marginwidth='0' marginheight='0' scrolling='no' border='0'>
            <FRAME name='apl' src='apl_frame.html' title='Apl' marginwidth='0' marginheight='0' scrolling='no'>
            <FRAME name='tv' src='tv.html' title='TV' marginwidth='0' marginheight='0' scrolling='no'>
      </FRAMESET>
      <FRAMESET id='down' cols='*, *'>
            <FRAME name='nts' src='nts_frame.html' title='Nts'>
            <FRAME name='cnt' src='cnt_frame.html' title='Cnt'>
      </FRAMESET>
</FRAMESET>
</HTML>

************************

and apl_frame.html:

************************

<APPLET code="MyApplet"
archive="apl.jar" width="100%" height="100%">
/APPLET>

****************************

and as soon as my page loads, I want my applet in apl_frame.html to get focus - because in the applet i have a text field that should get focus (but it doesn't)

thanks
0
 
LVL 2

Expert Comment

by:Epistemo
ID: 11948120
Did you try <body onLoad="window.focus()">  in the specific page?

Or try this ...

<body onload="location.hash = 'SuperApplet';">
<applet id="SuperApplet" code="MyApplet" archive="apl.jar" width="100%" height="100%"></applet>


0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 150 total points
ID: 11954911
in index.html do the frameset tag this way:

<frameset rows="65%,35%"
   onload=top.frames['Apl'].document.focus()">

But it may not work because the applet page is not a valid HTML page.  You will probably need to do the page this way:

<html>
<head></head>
<body>
<APPLET code="MyApplet"
archive="apl.jar" width="100%" height="100%">
</APPLET>
</body>
</html>


and it might also be necessary to put an id on the applet:

<APPLET id="xxx" code="MyApplet"
archive="apl.jar" width="100%" height="100%">
</APPLET>

The framset line would need to be:

<frameset rows="65%,35%"
   onload=top.frames['Apl'].document.getElementById('xxx').focus()">


Cd&
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

809 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