Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi i am trying to work out a way of changing the content of an Iframe via a dropdown. The purpose of this is that a user will choose a report from the drop down(these reports are aspx pages from another server)& the Iframe will then display the choosen report.
I have tried various ways of doing this including a content editor web part either with the markup directly in the html of the CEWP & also as a link to a txt file. Neither work as i want. Another way i have tried is using the following code but using this i cant work out how to change the size of the iframe which currently displays in a small iframe on the right hand side.
<html>
            <head>
            <script type="text/javascript">
            function loadFrame()
            {
            var s=document.getElementById("platform").value;

            document.getElementById("loadContainer").innerHTML=""
            var iframe = document.createElement("iframe");
            iframe.src = s;
            document.getElementById("loadContainer").appendChild(iframe);
            }
            </script>
            </head>
            <body>

            
            <form>
                Platform:
                <select id='platform'  önchange="loadFrame()">
                    <option value="http://">option1</option>
                    <option value="http://">option2</option>
                    <option value="http://">option3</option>
                </select>
            </form>
            

            
            </body>
            </html>

Any ideas
Posted
Updated 28-May-13 10:12am
v2
Comments
skybluebazza 28-May-13 16:18pm    
Thanks for the reply Richb. Not sure why that came through in the post, but it is not in my original code.
Richard C Bishop 28-May-13 16:20pm    
That is odd, ok well we can rule that out then.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900