Jump to content

PHP/HTML Possible Java or Ajax Help!


herghost

Recommended Posts

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?

 

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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"...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.