473,804 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set focus on a form element in one frame from a different frame

I can't make this work! I have two frames, a table of
contents frame on the left and a frame with lots of
form elements in it on the right.

<frameset rows="100%,*" cols="140,*">
<frame name="toc" src="toc.html">
<frame name="eadInput" src="form.html" >
</frameset>

I want to click on a table of contents link on the right,
then go to the <textarea> in the frame on the left **and
set the focus in that textarea** so the user can simply
begin typing.

<a href="form.html #abstract"
onClick="javasc ript:
parent.eadInput .document.eadFo rm.ABSTRACT.foc us();
parent.eadInput .focus()"
target="eadInpu t">

where "ABSTRACT" is the name of the <textarea> in the form
called "eadForm" in the right frame. In MSIE the focus is
switched to the right frame after clicking the link, but in
Firefox the focus stays on the left frame (which is why I
added that extra parent.eadInput .focus() to my event handler)

Can anybody tell me what I'm doing wrong?

Jul 23 '05 #1
4 11066
In article <cc**********@a gate.berkeley.e du>, ap********@hotm ail.com
enlightened us with...

<a href="form.html #abstract"
onClick="javasc ript:
parent.eadInput .document.eadFo rm.ABSTRACT.foc us();
parent.eadInput .focus()"
target="eadInpu t">


Try this for both browsers.

onClick="window .parent.frames['eadInput'].document.forms
['eadForm'].elements['ABSTRACT'].focus();"
--
--
~kaeli~
Doing my part to piss off the Religious Right.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
>kaeli wrote:
In article , ap********@hotm ail.com
enlightened us with...
<a href="form.html #abstract"
onClick="javasc ript:
parent.eadInput .document.eadFo rm.ABSTRACT.foc us();
parent.eadInput .focus()"
target="eadInpu t">


Try this for both browsers. onClick="windo w.parent.frames['eadInput'].document.forms
['eadForm'].elements['ABSTRACT'].focus();"


Nope, doesn't work in either browser. Everything scrolls to
where it should but no focussing.

I'm thinking the problem is somehow a conflict between the
href and the onClick. I'm thinking I'll have to put everything
in onClick and add some kind of scrollTo or location or something,
i.e., do everything--even the frame targetting--in the javascript.
I haven't tried that yet. Too many things to look up in the
Javascript book.
Jul 23 '05 #3
In article <cc***********@ agate.berkeley. edu>, ap********@hotm ail.com
enlightened us with...

Nope, doesn't work in either browser. Everything scrolls to
where it should but no focussing.

I'm thinking the problem is somehow a conflict between the
href and the onClick. I'm thinking I'll have to put everything
in onClick and add some kind of scrollTo or location or something,

Oh, of course. Silly me.
That *would* impact it.
Put a return false at the end of the onClick so the link is not followed
in browsers with script.

onClick="window .parent.frames['eadInput'].document.forms
['eadForm'].elements['ABSTRACT'].focus();return false;"

--
--
~kaeli~
If the funeral procession is at night, do folks drive with
their lights off?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4
kaeli wrote:
In article , ap********@hotm ail.com
enlightened us with...
Nope, doesn't work in either browser. Everything scrolls to
where it should but no focussing.

I'm thinking the problem is somehow a conflict between the
href and the onClick. I'm thinking I'll have to put everything
in onClick and add some kind of scrollTo or location or something,


Oh, of course. Silly me.
That *would* impact it.
Put a return false at the end of the onClick so the link is not followed
in browsers with script.

onClick="window .parent.frames['eadInput'].document.forms
['eadForm'].elements['ABSTRACT'].focus();return false;"


Wow. And OMG too. I would have bet lots of $$$ this wouldn't
work but you were nice enough to take the time to help me so
I thought I'd give it a try and what do you know? It works.
In both browsers.

It's not 100% perfect because it doesn't scroll to absolutely
the best place (so the anchor is at the top of the screen like
normal linking behavior) but I know why that is and I can live
with it. I might try playing around with some scrolling JS to
see if I can get just what I want, though.

Thank's for your help!

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
512
by: Darren Line | last post by:
Currently in my html document I use the onload command inthe body section to set the focus to a certain field. eg onload="document.form1.SerialNo.focus()" Is there a way to set the focus to another field in a different frame other than the one that the current document is in?
3
2628
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem follows: 1. At the beginning, focus is placed on an input text field of the first frame (so there's a blinking cursor on such field). 2. Then users click on a link of the second frame (thus focus is set
0
2118
by: Vinod. | last post by:
Hi all, I have added browser control to a windows form. I am loading pages having multiple frames. I have noticed that the focus in a text is not maintained when the application is deactivated. I fixed this issue by finding the active element in dom and then setting its focus. If the active element is a frameelement then I get the document of the frameelement and then get the activeelement of that document and set the focus. This works...
9
2414
by: fidodido | last post by:
If in the textarea (textarea3), the value is not "abc", and the user uses "Tab" to go to the next textarea (textarea4), it will alert an error message...and the focus will return to the textarea (textarea3) again... It works in Internet Explorer, however in firefox it does not work? Anyway have any ideas why & how? Here is the source, <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
3512
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything works fine as it also does in firefox if I call the contents frame directly (i.e. outside of its frameset). However, if I call my main page (index.html) which invokes the frame set, the contents frame javascript menubar onmouseover function...
2
55421
by: yawnmoth | last post by:
Say I have two input elements and that I wanted to make it so that when the first ones input was what it should be, the focus would automatically be shifted to the next input element. ie. something like... <input onkeyup="if (this.value.length == this.maxlength) document.forms.elements.focus()" value="whatever" maxvalue="x" type="text" /> <input value="whatever" maxvalue="x" type="text" />
4
1605
by: Helmut Jarausch | last post by:
Hi, I'm an absolute beginner with JavaScript. Say, I am in a window which I call WinA There I have <script> var WinA=self </script>
5
2111
by: baskarpr | last post by:
Could somebody help me ? I have a left frame and right frame in a page. There is a form in right frame which has number of text box, checkbox, radio button, some static text's. For every input item (and for some static text too), I have link in left frame. When I click in the left frame, I called a function like right frame.formName.item.focus() and cursor is placed in the input item of right frame. But this works only for the elements with...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.