arwebs
asked on
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.
<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.
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.myFor m.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.docum ent.myForm .txtName=' hello'">
parent.main.document.myFor
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.docum
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.docum ent.myform .txtName.v alue='the string'">
</form>
Joseph
<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.docum
</form>
Joseph
Are you having a joke with me Joseph?
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..
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.
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.
Ha! But I'm not Michel. ;|
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER