IFRAME AS FORM TARGET! POSSIBLE?

F

Federico Bari

Hi all,

does somebody know how to target the answer of a form to an iframe (in
ie expecially)???? I use iframe as temporary object to redirect the content
do a layer built with a <div...> tag; this is possible with an hiperlink:
clicking on it i can change the layer content whit a file in a URL location
storing the answer first in the iframe and then sending is content to the
<div...>. Here following the code:

<script>
function showText(){
theText = window.textFile.document.body.innerHTML;
MM_setTextOfLayer('Layer1','',theText)
if(theText>"")
alert(theText);
}
</script>

[...]

<div id="Layer1" style="position:absolute; left:218px; top:120px;
width:205px; height:134px; z-index:1"></div>
<p onClick="window.textFile.location = 'testo.txt'">prova </p>

testo.txt is just a static file; now i need to upgrad the final <div...>
layer with the answer of a form gived by a php script who accep GCI variable
.... i need to target the temp <iframe...> with a real html form. Somebody
know how can i do?????

Thank you very much. Federico.
 
J

Jukka K. Korpela

Federico Bari said:
does somebody know how to target the answer of a form to an iframe
(in
ie expecially)????

YES!!!! MANY PEOPLE KNOW THAT!!!! THERE ARE FREELY AVAILABLE (!!!! NO
OBLIGATIONS!!!!) AUTHORITATIVE DOCUMENTS THAT DESCRIBE THE HTML
LANGUAGES!!!!

oops sorry i too left the caps lock on and released it later than you did
anyway just give the iframe a name and use that name in a target attribute
more info http://www.cs.tut.fi/~jkorpela/html/iframe.html#target

On the other hand, you're probably doing something unnecessarily complex,
or pointless. If you had posted the URL, someone might have given help
with your real problem, not with the "solution" that you are using to
create problems.
 
F

Federico Bari

hi,

first of all thank you very much for your interest. I searched a lot in
intenet and i don't find so much document about it, believe me. I gave a
fast look to the document you suggest me and there is not explained my case
.... how to redirect a FORM answer to an iframe. I have already tried to
target the form to the iframe name ... it doesn't work becase all the page
is reload and not just the iframe content. Do you have any other idea?

Thank you again.

Fede.

PS: sorry i answered to your email address too; sorry.
 
F

Federico Bari

PS: better ... it doesn't load a new page in the original window ... it
opens a new window too!!! Could this help you to find a solution? Thank you
again. Fede.
 
F

Federico Bari

ok ... found the error. the id of ilayer was seted, but not the name. Now i
can do 2 things:

1) load an external file inside a <div...> layer (for example after a click)
without reload the entire page
2) load the answer of a form inside the same layer (again the entire page is
not reloaded, just the layer)

here following the code (put them in the same public directory of your web
server):

###################
# FILE test.htm:
###################

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText));
document.close();}
else innerHTML = unescape(newText);
}
function showText(){
theText = window.textFile.document.body.innerHTML;
MM_setTextOfLayer('Layer1','',theText)
}
//-->
</script>
</head>
<html>

<body>
<div id="Layer1" style="position:absolute; left:218px; top:120px;
width:205px; height:134px; z-index:1"></div>
<form>
<iframe id="textFile" name="textFile" style="display:none"
onLoad="showText()"></iframe>
<input type=button value=Hallo onClick="window.textFile.location =
'testo.txt'">
</form>
<form action="script.php" method="post" target="textFile"><input
name="testo" type="text"><input value="submit html test"
type="submit"></form>
<p>&nbsp;</p>
<p onClick="window.textFile.location = 'testo.txt'"><u><font
color="#0000FF">test</font></u>
</p>
</body>
</html>

#############################
# file: script.php
#############################


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<? echo("this is a test: $testo"); ?>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top