Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Idaho
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple IFrame Loader Isn't So Simple

    Maybe I'm going to embarass myself here but I am at a loss.

    I am trying to build a simple iframe loader. It seemed like such a simple idea and yet it just doesn't work. Could someone please look at my code and point me in the right direction.

    Here is what I have:
    Code:
    <html>
    <head>
    <title>IFrame File Loader</title>
    <script>
    function getFile(){
    var getSource = document.form.file.value;
    document.form.fileholder.src = getSource;
    }
    </script>
    </head>
    <body>
    <form name="form" id="form">
    <input type="file" name="file" id="file" size="133" onchange="getFile();" />
    <iframe name="fileHolder" id="fileHolder" src=""></iframe>
    </form>
    </body>
    </html>
    Any help would be greatly appreciated.
    .
    + Christ is the Rock - Rock On!

  • #2
    New Coder
    Join Date
    Aug 2006
    Location
    Idaho
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Found It!

    Here's what I got. Haven't cross tested it yet but works okay in IE.

    Code:
    <html>
    <head>
    <title>IFrame File Loader</title>
    <script>
    function fileLoad(){
    var strT = new String();
    document.getElementById("showFile").innerHTML = "";
    strT = document.form.file.value;
    if(strT != ""){
    strT = "<iframe id='Sample' src='" + strT + "'></iframe>";
    document.getElementById("showFile").innerHTML = strT;
    }
    }
    </script>
    </head>
    <body>
    <form name="form" id="form">
    <INPUT type="file" name="file" id="file" onChange="fileLoad();" /><br />
    <span name="showFile" id="showFile"></span>
    </form>
    </body>
    </html>
    .
    + Christ is the Rock - Rock On!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •