IFRAME AS FORM TARGET! POSSIBLE?

Discussion in 'HTML' started by Federico Bari, Sep 2, 2003.

  1. 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.
    Federico Bari, Sep 2, 2003
    #1
    1. Advertising

  2. "Federico Bari" <> 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
    Jukka K. Korpela, Sep 2, 2003
    #2
    1. Advertising

  3. IT DOESN'T WORK

    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" <> ha scritto nel messaggio
    news:Xns93EA5D14E98A8jkorpelacstutfi@193.229.0.31...
    > "Federico Bari" <> 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
    >
    >
    Federico Bari, Sep 2, 2003
    #3
  4. PS

    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.
    Federico Bari, Sep 2, 2003
    #4
  5. OK! ^_^

    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>
    Federico Bari, Sep 2, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Federico Bari

    IFRAME AS FORM TARGET! POSSIBLE?

    Federico Bari, Sep 2, 2003, in forum: Javascript
    Replies:
    0
    Views:
    103
    Federico Bari
    Sep 2, 2003
  2. Daedalous
    Replies:
    3
    Views:
    682
    Daedalous
    Jan 16, 2004
  3. Replies:
    2
    Views:
    189
  4. Replies:
    0
    Views:
    804
  5. acoleman616

    Canceling a form submitted to an iframe target

    acoleman616, Jan 6, 2010, in forum: Javascript
    Replies:
    31
    Views:
    405
    Jorge
    Jan 8, 2010
Loading...

Share This Page