...

View Full Version : Simple IFrame Loader Isn't So Simple



Scriptbanger
10-11-2006, 10:20 PM
:o 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:


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

Scriptbanger
10-11-2006, 10:55 PM
:thumbsup: Here's what I got. Haven't cross tested it yet but works okay in IE.



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum