• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

iframe asp

Once the btnsubmit is clicked, I want to carry txtabc.value to outsidetextbox
and make outsidediv = inline. Is it possible? If yes, please show me how.


<input name="txtabc" value=1">
<input type=submit name=btnsubmit>
<div id=outsidediv style="display:none">
<input name="outsidetextbox">
1 Solution
just a simple approach would be to have this (the iframe needs the "src" property and you need to use a form to submit, so):

you have an ASP called "theIframe.asp" that is the one to show within your other ASP's iFrame. This ASP has a form that will submit, taking the content of your control and displaying it on the other ASP's text control.

        <script type="text/javascript">
            function fncSubmit() {
                try {
                    var valueToCopy = document.getElementById("txtabc").value;
                    var targetObject = window.parent.document.getElementById("outsidetextbox");
                    targetObject.value = valueToCopy;
                    targetObject = window.parent.document.getElementById("outsidediv");
                    targetObject.style.visibility = "visible";
                } catch (err) {
                    var txt = "error: ";
                    txt = txt + err.description;
        <form onsubmit="fncSubmit();">
            <label>text iframe</label>
            <input id="txtabc" type="text" value="1">
            <input type="submit" id="btnsubmit" value="submit">

This is the another ASP "theAsp.asp" that is the one that calls the iFrame and displays the text once submitted

        <iframe id="theIframe" frameborder="1" src="theIframe.asp"></iframe>
        <div id="outsidediv" style="visibility:hidden">
            <label>text outsideiframe</label>
            <input type= "text" id="outsidetextbox">

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now