#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    1
    Rep Power
    0

    Question javascript window.open in PHP3 ?


    The following code is in a php3 program and DOES NOT open a new (php3) window, but if it is typed into Netscape Javascript typein it DOES Work?....What's up?print "<script language=\"JavaScript\">";
    print "<!-- ";
    print "function openwin(option) {";
    print " popupWin = window.open('http://mydomain.com/cgi-bin/something.php?q_option='+ escape(option), 'escape(option)','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable =no,width=132,height=137,left=15,top=15')";
    print "}";
    print "-->";
    print "</script>";

    print "<TD><A HREF=\" javascriptpenwin($option[$i]);\">";
    print "<IMG SRC=\"/images/nav/hear.gif\" BORDER=0>";
    print "</A></TD>";

    Any help appreciated,,,
  2. #2
  3. Oheim
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Austria
    Posts
    69
    Rep Power
    13
    Well, all this PHP script does, is output some JS code. Which you can change during the runtime of PHP.
    PHP does not actually open the window, just generates the code for the client (browser) to then open up the new window.

    Hope that helps...
    Sheriff
  4. #3
  5. No Profile Picture
    ,-)
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    Germany
    Posts
    13
    Rep Power
    0
    HI,

    try to slim down the code because window won't open (especially in Netscape) if theres a slight misspelling.

    How about this:

    <a href=\"javascript: popupWin = window.open('http://mydomain.com/cgi-bin/something.php', 'width=132','height=137','left=15','top=15')\" >open window</a>

    if this works (should) you can go on adding arguments so you see where the error is.


    btw: why do you print all that stuff?

    you can display it (outside php) as html and only put vars in php-brackets. So you will face lesser spelling-problems.


    <script language="JavaScript">
    <!--
    function openwin(option)
    {
    popupWin = window.open('http://mydomain.com/cgi-bin/something.php?q_option=<?php
    echo some optionvar; ?>', 'menubar=no','toolbar=no','location=no', 'directories=no','status=no','scrollbars=no','resizable
    =no','width=132','height=137','left=15','top=15')";
    }
    -->
    </script>

    print "<TD><A HREF=\" javascriptpenwin($option[$i]);\">";
    print "<IMG SRC=\"/images/nav/hear.gif\" BORDER=0>";
    print "</A></TD>";



    bombel

IMN logo majestic logo threadwatch logo seochat tools logo