Google

Kategorie

Reprezentacja Wiedzy

Kalendarz

May 2007
M T W T F S S
    Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

form.submit() do popup

May 31st, 2007 by prond

Nie raz spotkałem na forach poświęconych PHP, JavaScript, itp. posty typu “Jak przesłać dane z formularza do popupa”.
Po paru minutach googlania znalazłem kilka rozwiązań tego problemu i zrobiłem ich kompilację (kod poniżej).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>Axent Submit Form To PopUp Demo</title>
        <script type="text/javascript">
        function openTarget (form, features, windowName) {
            if (!windowName)
                windowName = 'formTarget' + (new Date().getTime());
            form.target = windowName;
            open ('', windowName, features);
        }
        </script>
    </head>
    <body>
        <form action="print_r.php" target="windowName" onsubmit="openTarget(this, 'width=300,height=300,resizable=1,scrollbars=1'); return true;" method="post">
            <input type="text" name="string" />
            <input type="submit" value="GO" />
        </form>
    </body>
</html>

Sprawdziłem, skrypt działa poprawnie na:

  • IE 6, 7
  • FF 2
  • Opera 9.10

Posted in Javascript, HTML |

One Response

  1. Paweł Rabinek Says:

    Dzięki ;) Właśnie mi się przydało! Sam jestem raczej słabiutki w JS… Pozdrawiam.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.