Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting vars across frames

    i have two frames on my page. one of them is named "forum" and it has an input field named "name" under a form named "form1". i'm trying to write the value of "name" on the other frame. I tried
    PHP Code:
    document.write(parent.frames["forum"].form1.name
    in the other frame but it didnt work. any suggestions?
    Also is there any way to execute a function in frame2 that is located in frame1?

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Please try the following

    parent.frameName2.document.write(parent.forum.form1.name.value)

    It is also advisable not to use the word name as a name as this is reserved word.

    Use something like isName or oName or even name1

    If you already have a page in your second frame then you'd be better targeting a div

    parent.frameName2.document.getElementById("div1").innerHTML=parent.forum.form1.name.value

    In frame 2 you would have

    <div id="div1"></div>

    Just a thought.....
    Last edited by Mr J; 03-26-2005 at 02:59 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •