Web Analytics Made Easy -
StatCounter How to use javascript popup in php - CodingForum

Announcement

Collapse
No announcement yet.

How to use javascript popup in php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use javascript popup in php

    I'm really jazzed about figuring PHP out and appreciate the time some have spent lending a hand
    I have popup windows I use for mail forms and either I'm going to can them because of the onslaught of popup stopper programs or try to use them which is what I really want. I was thinking the answer was in creating a function based on the javascript but since I'm just learning it seems a undaunting task. The code is from some forum I found a couple years ago that centers the window. The way I did it in straight html was call the code below from an external .js
    <js code>
    function PopUp(PopUpUrl,xW,xH){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((xW)/2);
    placementy=(ScreenHeight/2)-((xH+50)/2);
    WinPop=window.open(PopUpUrl,"","width="+xW+",height="+xH+",toolbar=0,location=0,directories=0,status =1,scrollbars=1,menubar=0,resizable=1,left="+placementx+",top="+placementy+",screenX=" +placementx+",screenY="+placementy+",");
    }
    </js code>
    And then call it thusly:
    <a href="email.htm" onclick="PopUp(this.href,'600','520');return false">
    I am stumped how to incorporate this. My attempt is below:
    <?
    function PopUp(PopUpUrl,xW,xH){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((xW)/2);
    placementy=(ScreenHeight/2)-((xH+50)/2);
    WinPop=window.open(PopUpUrl,"","width="+xW+",height="+xH+",toolbar=0,location=0,directories=0,status =1,scrollbars=1,menubar=0,resizable=1,left="+placementx+",top="+placementy+",screenX=" +placementx+",screenY="+placementy+",");
    }
    ?>
    But this isn't going to work:
    <?
    echo $popup['email.htm,'410','525']contact;
    OR
    'popup(email.htm,410,525)'
    ?>
    Thanks in advance for your help and time

  • #2
    Got it semi-working

    I kind of have it working using the js file but what's happening is the popup opens but the page from which it was launched also opens to the popup page.
    $text = array (
    'contact'=>'<a href=email.htm onclick=PopUp(this.href,410,525)>contact</a>',
    include = echo $text['contact'];
    Thanks!

    Comment

    Working...
    X