faqts : Computers : Programming : Languages : PHP : access : Knowledge Bases

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 11 people (100%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

how can i update a form with a link if the link is in left frame of a window. I have two frames.

Feb 18th, 2002 20:45
suresh kc, Bryan Tighe, Suresh KC


Say you have got a left frame (left.html) and the right frame 
(right.html)
in the main document (say index.html)
You would normally put this right?
<frameset cols="40%, *">
<frame src=left.html name=leftFrame>
<frame src=left.html name=rightFrame>
</frameset>
now say u have a link in left.html.
when the link is clicked call a javascript function in this way
<a href="javascript://"
onClick = "javascript:changeForm();">
Change Form on the Right
</a>
For instance, your form can have a name - myform
sample :
         <form name=myform>
                  <input type=text name=myfield size=5>
         </form>
You will need that function changeForm() defined in the left.html
inside the function write something like this
function changeForm() {
    //new value is the change you want to make
    var newValue = Math.random();
    window.parent.frames["rightFrame"].myform.myfield.value = newValue;
    //can say this too
    //window.parent["rightFrame"].myform.myfield.value = newValue;
}
Hope it helps.