Accessing controls in one frame from another

I have a frameset with 2 frames:

<frameset rows="20%,*">
<frame src="Toolbar.htm" name="tbar">
<frame src="Input.htm" name="main">
</frameset>

The page 'Input.htm' contains a textarea control (id=txtName).

The page 'Toolbar.htm' contains a number of buttons.

When I click one of these buttons, I want to modify the text in txtName. How do I do it?

I know this would be easier if I had the buttons on the same page as the textarea, but I need to do it this way.

Thanks in advance for your replies.
arwebsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arwebsAuthor Commented:
Edited text of question.
0
garrethgCommented:
If you gave your form the name "myForm" the correct reference to the input name="txtName" from the document in frame name="tbar" would be:

parent.main.document.myForm.txtName

So to change it's value you just set its value property from some function or expression, e.g.

<INPUT TYPE="button" VALUE="Set text to 'hello'" onClick="parent.main.document.myForm.txtName='hello'">
0
oubelkasCommented:
input.htm must have something like

<form name="myform">
<textarea name="txtName"></textarea>
</form>

then toolbar.htm has this :

<form name="myform2">
<input type="button" value="Put string" onClick="parent.main.document.myform.txtName.value='the string'">
</form>

Joseph
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

garrethgCommented:
Are you having a joke with me Joseph?
0
oubelkasCommented:
hehe...just added the .value....because this what it must be, not? Hey, don't worry my man, you may have the points if arwebs thinks your solution works..
0
garrethgCommented:
Yup, forgot to add .value (bugger). Er... at least I refered to it, if not in the code itself (desperate backsliding).

What you should have posted was something like michel would with another half a dozen references to why my code will not in the Bolivian localisied version of MSIE 3.14a. Then I couldn't respond.
0
oubelkasCommented:
Ha! But I'm not Michel. ;|
0
tripatCommented:
You can give target by the first answer given by garrethg
Good luck
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oubelkasCommented:
I see tripat, you're a newbie so,
mmm, please, answers like these should be posted as comments, not as answers. It's not fair to garrethg or me since we were here with some solutions which can help arwebs out. Your answer doesn't give any help to this question because the target isn't necessary to set here with this problem. In future please just give comments instead of answer like these.

Joseph

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.