Debt Consolidation - Property in Spain - Debt Consolidation - Debt Consolidation - Debt Consolidation

PDA

View Full Version : Load content in iframe from a javascript form


redrum
Dec 7th 2007, 5:37 am
I have a form where I want to load the content after submiting into an iframe

Javascript:

<script>
function go(){
var L1 = document.theform.list1.value;

if (L1!= "#")
{
var url = "http://www.url.com/" + L1 + ".html";
{ window.location = url; return false; }
}
}
</script>


The form:

<form name="theform">
<input name="list1" type="text" style="background-color:#ffffff; color: #666666; width: 160px;" size="20">
<input type="button" value="GO" onclick="go()"/>
</form>


The iframe:
<iframe name="lastframe" id="lastframe" SRC="lastframe.html" width="200" height="100" frameborder="0" marginwidth="0" marginheight="0" ></iframe>

How can I get this content target into an iframe?

Thanks,
Fredrik

redrum
Dec 7th 2007, 5:49 am
Hey it looks like I solved it. I changed
{ window.location = url; return false; }
to
document.getElementById("lastframe").src = url;