Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > IFRAME AS FORM TARGET! POSSIBLE?

Reply
Thread Tools

IFRAME AS FORM TARGET! POSSIBLE?

 
 
Federico Bari
Guest
Posts: n/a
 
      09-02-2003
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.




 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-02-2003
"Federico Bari" <(E-Mail Removed)> wrote:

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

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
Federico Bari
Guest
Posts: n/a
 
      09-02-2003
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.

"Jukka K. Korpela" <(E-Mail Removed)> ha scritto nel messaggio
news:Xns93EA5D14E98A8jkorpelacstutfi@193.229.0.31. ..
> "Federico Bari" <(E-Mail Removed)> wrote:
>
> > 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.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
> Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
>
>



 
Reply With Quote
 
Federico Bari
Guest
Posts: n/a
 
      09-02-2003
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.


 
Reply With Quote
 
Federico Bari
Guest
Posts: n/a
 
      09-02-2003
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[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
form have 2 iframe.problem to input text in other iframe elca Python 0 10-21-2009 10:00 AM
Targeting a parent iframe from a sub-iframe albanitus@yahoo.com HTML 0 11-15-2006 04:40 PM
parent/iframe set iframe source and submit form superfreaker@gmail.com Javascript 2 03-09-2006 11:05 PM
Safari, hidden iframe, submit form target = iframe chris.alex.thomas@gmail.com Javascript 0 02-21-2006 01:48 AM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM



Advertisments