Solved

getting focus for a frame

Posted on 2004-08-27
8
219 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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 50 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
remove Handler and Add Handler for one file 3 45
Web Application Architecture 6 78
How to analyze web traffic logs 10 108
Adding a hidden div to each row in a table 6 71
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

773 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