herghost Posted April 20, 2009 Share Posted April 20, 2009 Hi All, I have this simple piece of code: <?php if(isset($_GET['update'])) { //popup here } ?> It just checks to see if a user has closed a window. What I want is a popup message box here when the page is loaded. I have tried things like this : <?php if(isset($_GET['update'])) { echo "<body onload='window.open('message.php:','Popup_Window',"; echo "'toolbar=no,location=no,directories=no,status=no,"; echo "menubar=no,scrollbars=no,resizable=no,copyhistory=no,"; echo "width=600,height=400,top=30,left=20')' >"; } ?> Which just doesnt work How would I go about this? Quote Link to comment Share on other sites More sharing options...
taith Posted April 20, 2009 Share Posted April 20, 2009 firstly... theres no : at the end of message.php:... and secondly, is it outputing the script? if so, is there a js error? if not, your not passing $_GET[update] to the page thats calling for the popup Quote Link to comment Share on other sites More sharing options...
herghost Posted April 20, 2009 Author Share Posted April 20, 2009 Hi mate, thanks for your reply, I have done a bit of playing around and got to this: if(isset($_GET['update'])) { echo "<script type='text/JavaScript'>function popupMsg(msg) { alert(msg);}</script>"; echo "<SCRIPT LANGUAGE='javascript'>'onLoad='popupMsg('message here')</SCRIPT>"; echo "is this working"; } The is this working quote appears but nothing else happens, I am sure there is a simple way Quote Link to comment Share on other sites More sharing options...
taith Posted April 21, 2009 Share Posted April 21, 2009 echo "<SCRIPT LANGUAGE='javascript'>window.onload=function(popupMsg('message here'));</SCRIPT>"; Quote Link to comment Share on other sites More sharing options...
herghost Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks, Still does not work though, nothing pops up on page load, however my echo "test"; works Quote Link to comment Share on other sites More sharing options...
xtopolis Posted April 22, 2009 Share Posted April 22, 2009 if(true) { echo "<script type='text/JavaScript'>function popupMsg(msg) { alert(msg);}</script>"; echo "<SCRIPT LANGUAGE='javascript'>window.onLoad = popupMsg('message here')</SCRIPT>"; echo "is this working"; } This worked for me, an alert window popped up. The code you have in the first line is extraneous. You can simply make the second line be "alert" instead of "popupMsg"... Quote Link to comment Share on other sites More sharing options...
Darghon Posted April 22, 2009 Share Posted April 22, 2009 if(true) { echo "<script type='text/JavaScript'>function popupMsg(msg) { alert(msg);}</script>"; echo "<SCRIPT LANGUAGE='javascript'>window.onLoad = popupMsg('message here')</SCRIPT>"; echo "is this working"; } This worked for me, an alert window popped up. The code you have in the first line is extraneous. You can simply make the second line be "alert" instead of "popupMsg"... A little note, if you copy paste the function as it stands here, it won't work, javascript is case sensitive so make sure you use window.onload instead of window.onLoad Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.