• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

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.
0
arwebs
Asked:
arwebs
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now