whats wrong in this?

Discussion in 'PHP' started by champ_rock, Mar 12, 2007.

  1. #1
    please tell me what is wrong in this code? this does not put a popup when i place this code in php.. but if the same code is in a html file then i can see the popup coming
    
    <?php
    echo '<SCRIPT LANGUAGE="JavaScript"><!-- Begin 
    window.open ("http://google.com","mywindow") 
    // End --></script>';
    ?>
    
    Code (markup):

     
    champ_rock, Mar 12, 2007 IP
  2. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #2
    Try this:

    <?php
    echo "<SCRIPT LANGUAGE=\"JavaScript\"><!-- Begin
    window.open (\"http://google.com\",\"mywindow\")
    // End --></script>";
    ?>
     
    srobona, Mar 12, 2007 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I doubt there would be a problems in the quotes. If you have a JS debugger / console installed (using Firefox?) then you would have a better idea. I'm going to take a stab in the dark and say it's because your 'Begin' is not commented out.

    Try:
    <?php
    echo '<SCRIPT LANGUAGE="JavaScript"><!-- // Begin
    window.open ("http://google.com","mywindow")
    // End --></script>';
    ?>

    or even just:
    <?php
    echo '<SCRIPT LANGUAGE="JavaScript"><!--
    window.open ("http://google.com","mywindow")
    --></script>';
    ?>
     
    TwistMyArm, Mar 12, 2007 IP
  4. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok thanks a lot.. i tried the original script again and it seemed to work ;)

    dont know what was the problem that time..

    adding reps to u both.. :)
     
    champ_rock, Mar 12, 2007 IP
  5. kobra

    kobra Member

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    multiple lines I guess, if you were to put all the text one line you wouldn't have a problem
     
    kobra, Mar 16, 2007 IP