p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: R: using Javascript window.open in php


Message #1 by "G.S." <gsadmin@l...> on Sat, 5 Oct 2002 11:44:12 +0200
it works

-----Messaggio originale-----
Da: Jamal [mailto:new_mojam@y...] 
Inviato: sabato 5 ottobre 2002 10.46
A: beginning php
Oggetto: [beginning_php] using Javascript window.open in php

Hi,
why is my code not working?? Please anyone with an idea. Here is my
code.
this is index.html
<html> 
<head> 
<script language="javascript"> 
function openthing(url) 
{ 

// 1 single line!  not 3 lines

window.open(""+url+"","windowname","width=280,height=150, 
screenX=340,left=340,screenY=180,top=180,resizable=no, 
toolbar=no,status=no,menubar=no,scrollbars=no"); 
} 
</script> 
</head> 
<body> 
<a href="javascript:openthing('popup.php?link=1')">Link 1</a> 
<a href="javascript:openthing('popup.php?link=2')">Link 2</a> 
<a href="javascript:openthing('popup.php?link=3')">Link 3</a> 
<a href="javascript:openthing('popup.php?link=4')">Link 4</a> 
</body> 
</html> 


this is popup.php

<?  
/* "$QUERY_STRING" is the number after the question 
mark in the links above */ 
$QUERY_STRING = $link; 
?> 

<html> 
<head> 
</head> 
<body> 

<? 
if ($link == "1")  
    {print ("Information for Link number one");} 
elseif ($link == "2")  
    {print ("Information for Link number two");} 
elseif ($link == "3")  
    {print ("Information for Link number three");} 
elseif ($link == "4")  
    {print ("Information for Link number four");} 
else 
    {print ("Sorry, you did not pass a query value");} 
?> 

<p> 
<? if ($link == "1") {print ("");}  
   else {print ("<b>&laquo;</b>");}?>  
    
   <a href="popup.php?link=<? print ($link-1); ?>"> 
<? if ($link == "1") {print ("");}  
   else {print ("Previous Link");}?> 
   </a> 
    
   <b>&#149;</b> 
   <a href="Javascript://" onClick="window.close();">Close 
window</a>         
   <b>&#149;</b> 
    
   <a href="popup.php?link=<? print ($link+1); ?>"> 
<? if ($link == "4") {print ("");}  
   else {print ("Next Link");}?> 
   </a> 

<? if ($link == "4") {print ("");}  
   else {print ("<b>&raquo;</b>");}?> 
</p> 

</body> 
</html> 
the index.html is supposed to do the link but it is not doing it. Please

anyone to tell me why?? Or this might be better in the client side
rather 
than server-side??
thanks in advance
Mo jam



  Return to Index