Creating IFrame through javascript.

java , javascript United States
  • 8 years ago

    I want to create and laod IFrame in my page through Javascript.


    Thanks in advance for any help.

  • 8 years ago

    Hi GMike,


    Is this what you want to do?


    <html>
    <head>
    <script language="JavaScript" type="text/javascript">
    function makeFrame() {
       ifrm = document.createElement("IFRAME");
       ifrm.setAttribute("src", "http://developerfusion.com/");
       ifrm.style.width = 640+"px";
       ifrm.style.height = 480+"px";
       document.body.appendChild(ifrm);
    }
    </script>
    </head>
    <body>
    <p><a href="#" onMouseDown="makeFrame()">GO! </a></p>
    </body>
    </html>



    Regards,


    Bob

  • 8 years ago

    Bob,


    Thanks a lot you have given me the exact idea. keep it up man.


    Thanks again

  • 5 years ago

    Bob,

    Thanks!!

    This solve my problem which takes my hours to solve.

  • 3 years ago

    Bob,

    Thanks I was looking for this solution as well.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra