set a value in a form whin an iFrame

Posted on 2006-03-20
Last Modified: 2008-01-09
Hello Everyone,
   I am trying to set a value in a input text element within an iframe.....
   let me use expert-exchange JavaScript topic area as an example...


<iframe id="objViewer" style="HEIGHT: 95%; LEFT: 17%; OVERFLOW: auto; POSITION: absolute; TOP: 5%; WIDTH: 85%"height="400" width="1000" scrolling="Yes" src="" frameborder="1"></iframe>

            <select name="selLink" style="width: 136px" onchange="sendInfo(this.options[this.selectedIndex].value)">
                    <option value="Ace">ACE</option>
                    <option value="Image View">Image View</option>
                    <option value="value test">Value Test</option>


      function sendInfo(dText)
            case "value test":
                //////////////////////////// What do i place here to be able to access the form in the iframe to set the value
                                                    say for example: Form(SearchForm)
                                                                             Input Text(query)

Question by:tony_813
    LVL 10

    Expert Comment

    Try this:

    frames['objViewer'].document.getElementById('query').value = 'the value of the query';
    LVL 9

    Author Comment

    thns for the quick reponse...
    I tried your suggestion and I got the following error message:

        Access is denied.
    LVL 7

    Accepted Solution

    For browse security, cannot access the frame that in different domain, you will get "Permission Denied" when Scripting Across Frames (at least in IE).

    To Create Cross-Frame Scripting-Capable Web Pages with HTML Applications (HTAs);en-us;241754
    LVL 9

    Author Comment

        not the info I wanted to say..... but hey.. at leas i'm not going to be here all night trying to get it to work..

    thank you for you info


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now