• 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.

Thanks,


<iframe>
<input name="txtabc" value=1">
<input type=submit name=btnsubmit>
</iframe>
<div id=outsidediv style="display:none">
<input name="outsidetextbox">
</div>
0
Webboy2008
Asked:
Webboy2008
1 Solution
 
baretreeCommented:
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.

<html>
    <head>
        <title>theAsp</title>
        <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;
                    alert(txt);
                } 
            }
	    </script>
    </head>
    <body>
        <form onsubmit="fncSubmit();">
            <label>text iframe</label>
            <input id="txtabc" type="text" value="1">
            <input type="submit" id="btnsubmit" value="submit">
        </form>
    </body>
</html>


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

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

Open in new window

0
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