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

    get selected input field in iframe

    Hello,
    I would like to know if there is a way to get the selected input field inside an Iframe from the parent window, is there any way to do that?
    Thanks

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    try this:

    Code:
    var zValue = frameName.document.getElementById("inputFieldId").value;

  • #3
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry for not being clear.
    I need to get the selected field that the user clicked on inside an iframe.

  • #4
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    you can do this in you iframe:
    Code:
    <input type="text" onclick="selectObject(this)"></input>
    Code:
    var curObject = null;
    function selectObject(obj)
    {
       curObject= obj;
    }
    and then in your parent frame you do the following:
    Code:
    if(frameName.curObject != null)
    { 
       var zValue = frameName.curObject.value;
    }


  •  

    Posting Permissions

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