Afternoon everyone – Onclick of “contact “Pop-Up “Contact-Sms-Centre.php'

Can anyone help with this – iv got a php page that returns the following as part of a set of results

<a href='Contact-Sms-Centre.php'>Contact</a> $city $country<hr

The contact sms centre is width=450,height=350'

I also have the popup.php as shown below

<html>

<head>
</head>
<body>
<?php
print "<script type='text/javascript'>";
print "window.open('Contact-Sms-Centre.php','new_window1','status=1,scrollbars=0,resizable=0,menu=no,left=450,top=275,width=450,height=350');";
print "</script>";  
?>
</body>
</html>

The Only way I can get the POPUP to work is if I open popup.php and press refresh ???
This action will POPUP the contact-sms-centre but it also leaves the blank popup.php in the back ground.

How I’d like it to work is –

Once I click on “Contact” in the following code <a href='Contact-Sms-Centre.php'>Contact</a> $city $country<hr I would like the sms-centre window to popup on the page the above results are returned too ?? for this example the results page is named results.php

If anyone can reply with how to achieve my goal with the popup and explain where I am going wrong

Help, like always is very much appreciated – as is – Your input.

Hi there,
What you could try is changing your link from instead of having an href attribute, make an onclick attribute and put that line of javascript from your popup.php file into the onclick's value without the script tags etc. Example: <a onclick='window.open('Contact-Sms-Centre.php','new_window1','status=1,scrollbars=0,resizable=0,menu=no,left=450,top=2 ....) '>Contact</a>

I'm not sure if this will work for you because I'm not 100% sure what you're trying to achieve, but good luck. Let me know if it works :)

Hi there,
What you could try is changing your link from instead of having an href attribute, make an onclick attribute and put that line of javascript from your popup.php file into the onclick's value without the script tags etc. Example: <a onclick='window.open('Contact-Sms-Centre.php','new_window1','status=1,scrollbars=0,resizable=0,menu=no,left=450,top=2 ....) '>Contact</a>

I'm not sure if this will work for you because I'm not 100% sure what you're trying to achieve, but good luck. Let me know if it works :)

Hi.... thanks for your reply -

Im trying to open contact-sms-centre as a POPUP window - from the results page.

Im not sure how to create an "onclick event"

a popup, will get blocked on more browsers every day,
and get flagged as malicious,
whether it is or not
this code scrap creates a link that opens or closes a layer above the current page at the link location, put your contact details in it, and <?php include('poplayer.inc.php'); ?> or paste the code
wherever you want the link to appeartables are passe, its example code prettify it up with your css

<!--poplayer.inc.php-->
<script language="javascript" type="text/javascript">
<!--
(document.getElementById) ? dom = true : dom = false; //check ie or ff
function hideIt(layer) {
 if (dom) {document.getElementById(layer).style.visibility='hidden';} //ie
 if (document.layers) {document.layers[layer].visibility='hide';} } //ff
function showIt(layer) {
 if (dom) {document.getElementById(layer).style.visibility='visible';}
 if (document.layers) {document.layers[layer].visibility='show';} }
//-->
</script>
<a href='#' onClick="showIt('layer1');">Contact Us</button>
<div id="layer1" style="visibility:hidden;">
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="right" onClick="hideIt('layer1')">Close</td>
</tr>
<tr>
<td>
<UL compact>
<li>in this case the content of the popup page goes in this div</li>
<li>bla bla bla bla</li>
<li>bla bla bla bla</li>
<li>bla bla bla bla</li>
<li>bla bla bla bla</li>
<li>bla bla bla bla</li>
<li>bla bla bla bla</li>
</ul>
</td>
</tr>
<tr>
<td align="right" onClick="hideIt('layer1')">Close</font>
</td>
</tr>
</table>
</div>

Hi, many thanks for your reply many weeks ago,

I have started looking into this and whilst the js script opens the "layer" clicking close does not close the layer.

can anyone help with this please...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.