Web Analytics Made Easy -
StatCounter Simple IFrame Loader Isn't So Simple - CodingForum

Announcement

Collapse
No announcement yet.

Simple IFrame Loader Isn't So Simple

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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!

    Comment

    Working...
    X