<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt">
<head>
<title>Teste</title>
<style>
#novaFrame {
margin: 0 auto;
width: 800px;
height: 600px;
}
</style>
<script type="text/javascript">
function changeContent(){
// Buscar os valores que interessam à DOM
var orig = document.getElementById("clique");
var url = document.getElementById("url").value;
// Criar uma nova frame
var frame = document.createElement("iframe");
// Atribuir as características à nova frame
frame.setAttribute("src",url);
frame.setAttribute("id","novaFrame");
// Substituir o conteúdo da div "clique"
orig.innerHTML = "";
orig.appendChild(frame);
}
</script>
</head>
<body>
<div id="clique">
<input type="text" name="url" id="url" /><br />
<input type="button" value="Carregar" onClick="changeContent();" />
</div>
</body>
</html>
Está ai. O código cria uma nova frame e substitui o conteúdo da div clique com a iframe.
Se a ideia for carregar a frame numa outra localização (e não substituir o formulário), deixo uma pequena variação:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt">
<head>
<title>Teste</title>
<style>
#novaFrame {
margin: 0 auto;
width: 800px;
height: 600px;
}
</style>
<script type="text/javascript">
function changeContent(){
// Buscar os valores que interessam à DOM
var url = document.getElementById("url").value;
// Criar uma nova frame
var frame = document.createElement("iframe");
// Atribuir as características à nova frame
frame.setAttribute("src",url);
frame.setAttribute("id","novaFrame");
// Mostrar div "escondida" e adicionar-lhe a frame
var orig = document.getElementById("escondida");
orig.appendChild(frame);
orig.style.display = "block";
}
</script>
</head>
<body>
<div id="clique">
<input type="text" name="url" id="url" /><br />
<input type="button" value="Carregar" onClick="changeContent();" />
</div>
<div id="escondida" style="display: none;"></div>
</body>
</html>