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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    assign a variable to textbox

    Morning,
    I need to assign a variable in one frame to a textbox in another when the textbox page opens.

    In a frame named "content" I have
    <input type="text" name="T122" size="20" style="position: absolute; left: 213; top: 77; height: 15px; width: 380px; font-size: 8pt; text-transform: uppercase; font-weight: bold; text-align: center; border: 1px solid #FFFFFF" tabindex="1">

    The variable is parent.content1.jNum
    I need to be able to have this textbox's value show the variable when the page opens in its frame....any ideas would be appreciated
    Shannon

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    try this in frame's head

    PHP Code:
    <script language="JavaScript" type="text/JavaScript">
    onload=function(){document.forms[0].elements['T122'].value=parent.document.forms['content1'].elements['jNum'].value}
    </script> 
    But I am a little cofused... Where is the variable to be passed? (parent? another frame?)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for replying KOR,
    Perhaps I was unclear...I have a frame called "content" in which a page opens in, that has a text box
    (no form associated with this text box -css type page)
    This Text box is called T122.
    I need this textbox to display the value of jNum when the page is opened in its frame. jNum is a variable in another frame called "content1"
    hope this is clearer.
    shannon

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    no form associated
    Than associate it simply nest the text box inside a form
    <form>
    ...your text box
    ...
    </form>

    and the code should work
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    As I understand, jNum is a variable and not an element's name.
    Code:
    onload = function(){
      document.forms[0].elements['T122'].value = parent.frames['content1'].jNum;
    }


  •  

    Posting Permissions

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